aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Python/thread_nt.h
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2024-02-12 07:53:52 +0300
committershadchin <shadchin@yandex-team.com>2024-02-12 08:07:36 +0300
commitce1b7ca3171f9158180640c6a02a74b4afffedea (patch)
treee47c1e8391b1b0128262c1e9b1e6ed4c8fff2348 /contrib/tools/python3/src/Python/thread_nt.h
parent57350d96f030db90f220ce50ee591d5c5d403df7 (diff)
downloadydb-ce1b7ca3171f9158180640c6a02a74b4afffedea.tar.gz
Update Python from 3.11.8 to 3.12.2
Diffstat (limited to 'contrib/tools/python3/src/Python/thread_nt.h')
-rw-r--r--contrib/tools/python3/src/Python/thread_nt.h40
1 files changed, 13 insertions, 27 deletions
diff --git a/contrib/tools/python3/src/Python/thread_nt.h b/contrib/tools/python3/src/Python/thread_nt.h
index 084bd58731..26f441bd6d 100644
--- a/contrib/tools/python3/src/Python/thread_nt.h
+++ b/contrib/tools/python3/src/Python/thread_nt.h
@@ -152,11 +152,12 @@ unsigned long PyThread_get_thread_native_id(void);
#endif
/*
- * Initialization of the C package, should not be needed.
+ * Initialization for the current runtime.
*/
static void
PyThread__init_thread(void)
{
+ // Initialization of the C package should not be needed.
}
/*
@@ -188,8 +189,6 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
unsigned threadID;
callobj *obj;
- dprintf(("%lu: PyThread_start_new_thread called\n",
- PyThread_get_thread_ident()));
if (!initialized)
PyThread_init_thread();
@@ -209,14 +208,10 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
* too many threads".
*/
int e = errno;
- dprintf(("%lu: PyThread_start_new_thread failed, errno %d\n",
- PyThread_get_thread_ident(), e));
threadID = (unsigned)-1;
HeapFree(GetProcessHeap(), 0, obj);
}
else {
- dprintf(("%lu: PyThread_start_new_thread succeeded: %p\n",
- PyThread_get_thread_ident(), (void*)hThread));
CloseHandle(hThread);
}
return threadID;
@@ -257,7 +252,6 @@ PyThread_get_thread_native_id(void)
void _Py_NO_RETURN
PyThread_exit_thread(void)
{
- dprintf(("%lu: PyThread_exit_thread called\n", PyThread_get_thread_ident()));
if (!initialized)
exit(0);
_endthreadex(0);
@@ -271,24 +265,22 @@ PyThread_exit_thread(void)
PyThread_type_lock
PyThread_allocate_lock(void)
{
- PNRMUTEX aLock;
+ PNRMUTEX mutex;
- dprintf(("PyThread_allocate_lock called\n"));
if (!initialized)
PyThread_init_thread();
- aLock = AllocNonRecursiveMutex() ;
+ mutex = AllocNonRecursiveMutex() ;
- dprintf(("%lu: PyThread_allocate_lock() -> %p\n", PyThread_get_thread_ident(), aLock));
+ PyThread_type_lock aLock = (PyThread_type_lock) mutex;
+ assert(aLock);
- return (PyThread_type_lock) aLock;
+ return aLock;
}
void
PyThread_free_lock(PyThread_type_lock aLock)
{
- dprintf(("%lu: PyThread_free_lock(%p) called\n", PyThread_get_thread_ident(),aLock));
-
FreeNonRecursiveMutex(aLock) ;
}
@@ -307,6 +299,8 @@ PyLockStatus
PyThread_acquire_lock_timed(PyThread_type_lock aLock,
PY_TIMEOUT_T microseconds, int intr_flag)
{
+ assert(aLock);
+
/* Fow now, intr_flag does nothing on Windows, and lock acquires are
* uninterruptible. */
PyLockStatus success;
@@ -333,20 +327,14 @@ PyThread_acquire_lock_timed(PyThread_type_lock aLock,
milliseconds = INFINITE;
}
- dprintf(("%lu: PyThread_acquire_lock_timed(%p, %lld) called\n",
- PyThread_get_thread_ident(), aLock, microseconds));
-
- if (aLock && EnterNonRecursiveMutex((PNRMUTEX)aLock,
- (DWORD)milliseconds) == WAIT_OBJECT_0) {
+ if (EnterNonRecursiveMutex((PNRMUTEX)aLock,
+ (DWORD)milliseconds) == WAIT_OBJECT_0) {
success = PY_LOCK_ACQUIRED;
}
else {
success = PY_LOCK_FAILURE;
}
- dprintf(("%lu: PyThread_acquire_lock(%p, %lld) -> %d\n",
- PyThread_get_thread_ident(), aLock, microseconds, success));
-
return success;
}
int
@@ -358,10 +346,8 @@ PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag)
void
PyThread_release_lock(PyThread_type_lock aLock)
{
- dprintf(("%lu: PyThread_release_lock(%p) called\n", PyThread_get_thread_ident(),aLock));
-
- if (!(aLock && LeaveNonRecursiveMutex((PNRMUTEX) aLock)))
- dprintf(("%lu: Could not PyThread_release_lock(%p) error: %ld\n", PyThread_get_thread_ident(), aLock, GetLastError()));
+ assert(aLock);
+ (void)LeaveNonRecursiveMutex((PNRMUTEX) aLock);
}
/* minimum/maximum thread stack sizes supported */