Linux vps-61133.fhnet.fr 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
Apache/2.4.25 (Debian)
Server IP : 93.113.207.21 & Your IP : 216.73.216.41
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
src /
Python-3.10.14 /
Python /
Delete
Unzip
Name
Size
Permission
Date
Action
clinic
[ DIR ]
drwxr-xr-x
2024-03-19 22:46
Python-ast.c
403.1
KB
-rw-r--r--
2024-03-19 22:46
Python-ast.gcda
73.55
KB
-rw-r--r--
2025-06-04 09:21
Python-ast.o
1.64
MB
-rw-r--r--
2025-06-04 09:22
README
62
B
-rw-r--r--
2024-03-19 22:46
_warnings.c
37.47
KB
-rw-r--r--
2024-03-19 22:46
_warnings.gcda
10.5
KB
-rw-r--r--
2025-06-04 09:21
_warnings.o
274.36
KB
-rw-r--r--
2025-06-04 09:22
asdl.c
188
B
-rw-r--r--
2024-03-19 22:46
asdl.gcda
3.98
KB
-rw-r--r--
2025-06-04 09:21
asdl.o
41.46
KB
-rw-r--r--
2025-06-04 09:22
ast.c
33.83
KB
-rw-r--r--
2024-03-19 22:46
ast.gcda
8.98
KB
-rw-r--r--
2025-06-04 09:21
ast.o
162
KB
-rw-r--r--
2025-06-04 09:22
ast_opt.c
29.15
KB
-rw-r--r--
2024-03-19 22:46
ast_opt.gcda
10.67
KB
-rw-r--r--
2025-06-04 09:21
ast_opt.o
464.67
KB
-rw-r--r--
2025-06-04 09:22
ast_unparse.c
25.85
KB
-rw-r--r--
2024-03-19 22:46
ast_unparse.gcda
9.81
KB
-rw-r--r--
2025-06-04 09:21
ast_unparse.o
204.5
KB
-rw-r--r--
2025-06-04 09:22
bltinmodule.c
88.5
KB
-rw-r--r--
2024-03-19 22:46
bltinmodule.gcda
17.87
KB
-rw-r--r--
2025-06-04 09:21
bltinmodule.o
611.81
KB
-rw-r--r--
2025-06-04 09:22
bootstrap_hash.c
18.18
KB
-rw-r--r--
2024-03-19 22:46
bootstrap_hash.gcda
4.34
KB
-rw-r--r--
2025-06-04 09:21
bootstrap_hash.o
63.27
KB
-rw-r--r--
2025-06-04 09:22
ceval.c
206.97
KB
-rw-r--r--
2024-03-19 22:46
ceval.gcda
29.57
KB
-rw-r--r--
2025-06-04 09:21
ceval.o
1.21
MB
-rw-r--r--
2025-06-04 09:22
ceval_gil.h
12.19
KB
-rw-r--r--
2024-03-19 22:46
codecs.c
45.02
KB
-rw-r--r--
2024-03-19 22:46
codecs.gcda
12.75
KB
-rw-r--r--
2025-06-04 09:21
codecs.o
329.38
KB
-rw-r--r--
2025-06-04 09:22
compile.c
233.08
KB
-rw-r--r--
2024-03-19 22:46
compile.gcda
43.95
KB
-rw-r--r--
2025-06-04 09:21
compile.o
1.79
MB
-rw-r--r--
2025-06-04 09:22
condvar.h
8.44
KB
-rw-r--r--
2024-03-19 22:46
context.c
30.93
KB
-rw-r--r--
2024-03-19 22:46
context.gcda
9.95
KB
-rw-r--r--
2025-06-04 09:21
context.o
200.97
KB
-rw-r--r--
2025-06-04 09:22
dtoa.c
78.28
KB
-rw-r--r--
2024-03-19 22:46
dtoa.gcda
10.32
KB
-rw-r--r--
2025-06-04 09:21
dtoa.o
658.92
KB
-rw-r--r--
2025-06-04 09:22
dup2.c
759
B
-rw-r--r--
2024-03-19 22:46
dynamic_annotations.c
6.59
KB
-rw-r--r--
2024-03-19 22:46
dynamic_annotations.o
2.16
KB
-rw-r--r--
2025-06-04 09:22
dynload_hpux.c
2.12
KB
-rw-r--r--
2024-03-19 22:46
dynload_shlib.c
3.47
KB
-rw-r--r--
2024-03-19 22:46
dynload_shlib.gcda
3.77
KB
-rw-r--r--
2025-06-04 09:21
dynload_shlib.o
78.03
KB
-rw-r--r--
2025-06-04 09:22
dynload_stub.c
186
B
-rw-r--r--
2024-03-19 22:46
dynload_win.c
9.97
KB
-rw-r--r--
2024-03-19 22:46
errors.c
49.3
KB
-rw-r--r--
2024-03-19 22:46
errors.gcda
11.97
KB
-rw-r--r--
2025-06-04 09:21
errors.o
604.46
KB
-rw-r--r--
2025-06-04 09:22
fileutils.c
65.03
KB
-rw-r--r--
2024-03-19 22:46
fileutils.gcda
9.9
KB
-rw-r--r--
2025-06-04 09:21
fileutils.o
235.27
KB
-rw-r--r--
2025-06-04 09:22
formatter_unicode.c
50.35
KB
-rw-r--r--
2024-03-19 22:46
formatter_unicode.gcda
7.99
KB
-rw-r--r--
2025-06-04 09:21
formatter_unicode.o
352.49
KB
-rw-r--r--
2025-06-04 09:22
frozen.c
1.31
KB
-rw-r--r--
2024-03-19 22:46
frozen.o
122.48
KB
-rw-r--r--
2025-06-04 09:22
frozen_hello.h
547
B
-rw-r--r--
2024-03-19 22:46
frozenmain.c
3.12
KB
-rw-r--r--
2024-03-19 22:46
frozenmain.o
55.7
KB
-rw-r--r--
2025-06-04 09:22
future.c
4.35
KB
-rw-r--r--
2024-03-19 22:46
future.gcda
3.91
KB
-rw-r--r--
2025-06-04 09:21
future.o
69.3
KB
-rw-r--r--
2025-06-04 09:22
getargs.c
83.81
KB
-rw-r--r--
2024-03-19 22:46
getargs.gcda
14.68
KB
-rw-r--r--
2025-06-04 09:21
getargs.o
702.23
KB
-rw-r--r--
2025-06-04 09:22
getcompiler.c
534
B
-rw-r--r--
2024-03-19 22:46
getcompiler.gcda
3.48
KB
-rw-r--r--
2025-06-04 09:21
getcompiler.o
31.86
KB
-rw-r--r--
2025-06-04 09:22
getcopyright.c
511
B
-rw-r--r--
2024-03-19 22:46
getcopyright.gcda
3.48
KB
-rw-r--r--
2025-06-04 09:21
getcopyright.o
32.27
KB
-rw-r--r--
2025-06-04 09:22
getopt.c
4.6
KB
-rw-r--r--
2024-03-19 22:46
getopt.gcda
3.82
KB
-rw-r--r--
2025-06-04 09:21
getopt.o
43.34
KB
-rw-r--r--
2025-06-04 09:22
getplatform.c
133
B
-rw-r--r--
2024-03-19 22:46
getplatform.gcda
3.48
KB
-rw-r--r--
2025-06-04 09:21
getplatform.o
31.85
KB
-rw-r--r--
2025-06-04 09:22
getversion.c
308
B
-rw-r--r--
2024-03-19 22:46
getversion.gcda
3.5
KB
-rw-r--r--
2025-06-04 09:21
getversion.o
32.93
KB
-rw-r--r--
2025-06-04 09:22
hamt.c
78.82
KB
-rw-r--r--
2024-03-19 22:46
hamt.gcda
11.18
KB
-rw-r--r--
2025-06-04 09:21
hamt.o
257.84
KB
-rw-r--r--
2025-06-04 09:22
hashtable.c
11.17
KB
-rw-r--r--
2024-03-19 22:46
hashtable.gcda
5.66
KB
-rw-r--r--
2025-06-04 09:21
hashtable.o
84.36
KB
-rw-r--r--
2025-06-04 09:22
import.c
62.01
KB
-rw-r--r--
2024-03-19 22:46
import.gcda
17.11
KB
-rw-r--r--
2025-06-04 09:21
import.o
461.4
KB
-rw-r--r--
2025-06-04 09:22
importdl.c
7.32
KB
-rw-r--r--
2024-03-19 22:46
importdl.gcda
4.35
KB
-rw-r--r--
2025-06-04 09:21
importdl.h
487
B
-rw-r--r--
2024-03-19 22:46
importdl.o
71.44
KB
-rw-r--r--
2025-06-04 09:22
importlib.h
99.12
KB
-rw-r--r--
2024-03-19 22:46
importlib_external.h
147.15
KB
-rw-r--r--
2024-03-19 22:46
importlib_zipimport.h
57.35
KB
-rw-r--r--
2024-03-19 22:46
initconfig.c
89.33
KB
-rw-r--r--
2024-03-19 22:46
initconfig.gcda
20.45
KB
-rw-r--r--
2025-06-04 09:21
initconfig.o
482.04
KB
-rw-r--r--
2025-06-04 09:22
makeopcodetargets.py
1.55
KB
-rwxr-xr-x
2024-03-19 22:46
marshal.c
48.33
KB
-rw-r--r--
2024-03-19 22:46
marshal.gcda
13.91
KB
-rw-r--r--
2025-06-04 09:21
marshal.o
325.08
KB
-rw-r--r--
2025-06-04 09:22
modsupport.c
18.12
KB
-rw-r--r--
2024-03-19 22:46
modsupport.gcda
6.66
KB
-rw-r--r--
2025-06-04 09:21
modsupport.o
243.86
KB
-rw-r--r--
2025-06-04 09:22
mysnprintf.c
2.49
KB
-rw-r--r--
2024-03-19 22:46
mysnprintf.gcda
3.56
KB
-rw-r--r--
2025-06-04 09:21
mysnprintf.o
39.3
KB
-rw-r--r--
2025-06-04 09:22
mystrtoul.c
8.09
KB
-rw-r--r--
2024-03-19 22:46
mystrtoul.gcda
3.93
KB
-rw-r--r--
2025-06-04 09:21
mystrtoul.o
64.22
KB
-rw-r--r--
2025-06-04 09:22
opcode_targets.h
6.31
KB
-rw-r--r--
2024-03-19 22:46
pathconfig.c
19.75
KB
-rw-r--r--
2024-03-19 22:46
pathconfig.gcda
7.42
KB
-rw-r--r--
2025-06-04 09:21
pathconfig.o
110.59
KB
-rw-r--r--
2025-06-04 09:22
preconfig.c
25.21
KB
-rw-r--r--
2024-03-19 22:46
preconfig.gcda
6.76
KB
-rw-r--r--
2025-06-04 09:21
preconfig.o
140.21
KB
-rw-r--r--
2025-06-04 09:22
pyarena.c
5.52
KB
-rw-r--r--
2024-03-19 22:46
pyarena.gcda
3.97
KB
-rw-r--r--
2025-06-04 09:21
pyarena.o
48.03
KB
-rw-r--r--
2025-06-04 09:22
pyctype.c
7.73
KB
-rw-r--r--
2024-03-19 22:46
pyctype.o
32.77
KB
-rw-r--r--
2025-06-04 09:22
pyfpe.c
345
B
-rw-r--r--
2024-03-19 22:46
pyfpe.o
4.01
KB
-rw-r--r--
2025-06-04 09:22
pyhash.c
13.45
KB
-rw-r--r--
2024-03-19 22:46
pyhash.gcda
4.16
KB
-rw-r--r--
2025-06-04 09:21
pyhash.o
70.6
KB
-rw-r--r--
2025-06-04 09:22
pylifecycle.c
80.77
KB
-rw-r--r--
2024-03-19 22:46
pylifecycle.gcda
15.06
KB
-rw-r--r--
2025-06-04 09:21
pylifecycle.o
390.44
KB
-rw-r--r--
2025-06-04 09:22
pymath.c
1.6
KB
-rw-r--r--
2024-03-19 22:46
pymath.gcda
3.54
KB
-rw-r--r--
2025-06-04 09:21
pymath.o
32.34
KB
-rw-r--r--
2025-06-04 09:22
pystate.c
56.36
KB
-rw-r--r--
2024-03-19 22:46
pystate.gcda
12.61
KB
-rw-r--r--
2025-06-04 09:21
pystate.o
238.3
KB
-rw-r--r--
2025-06-04 09:22
pystrcmp.c
753
B
-rw-r--r--
2024-03-19 22:46
pystrcmp.gcda
3.62
KB
-rw-r--r--
2025-06-04 09:21
pystrcmp.o
37.12
KB
-rw-r--r--
2025-06-04 09:22
pystrhex.c
5.24
KB
-rw-r--r--
2024-03-19 22:46
pystrhex.gcda
4.09
KB
-rw-r--r--
2025-06-04 09:21
pystrhex.o
55.29
KB
-rw-r--r--
2025-06-04 09:22
pystrtod.c
40.06
KB
-rw-r--r--
2024-03-19 22:46
pystrtod.gcda
5.14
KB
-rw-r--r--
2025-06-04 09:21
pystrtod.o
96.01
KB
-rw-r--r--
2025-06-04 09:22
pythonrun.c
42.71
KB
-rw-r--r--
2024-03-19 22:46
pythonrun.gcda
11.89
KB
-rw-r--r--
2025-06-04 09:21
pythonrun.o
282.42
KB
-rw-r--r--
2025-06-04 09:22
pytime.c
28.68
KB
-rw-r--r--
2024-03-19 22:46
pytime.gcda
7.47
KB
-rw-r--r--
2025-06-04 09:21
pytime.o
120.86
KB
-rw-r--r--
2025-06-04 09:22
stdlib_module_names.h
3.49
KB
-rw-r--r--
2024-03-19 22:46
structmember.c
8.83
KB
-rw-r--r--
2024-03-19 22:46
structmember.gcda
4.83
KB
-rw-r--r--
2025-06-04 09:21
structmember.o
73.16
KB
-rw-r--r--
2025-06-04 09:22
suggestions.c
8.46
KB
-rw-r--r--
2024-03-19 22:46
suggestions.gcda
4.29
KB
-rw-r--r--
2025-06-04 09:21
suggestions.o
57.27
KB
-rw-r--r--
2025-06-04 09:22
symtable.c
72.25
KB
-rw-r--r--
2024-03-19 22:46
symtable.gcda
15.05
KB
-rw-r--r--
2025-06-04 09:21
symtable.o
638.03
KB
-rw-r--r--
2025-06-04 09:22
sysmodule.c
94.57
KB
-rw-r--r--
2024-03-19 22:46
sysmodule.gcda
19.89
KB
-rw-r--r--
2025-06-04 09:21
sysmodule.o
579.73
KB
-rw-r--r--
2025-06-04 09:22
thread.c
5.8
KB
-rw-r--r--
2024-03-19 22:46
thread.gcda
6.58
KB
-rw-r--r--
2025-06-04 09:21
thread.o
133.44
KB
-rw-r--r--
2025-06-04 09:22
thread_nt.h
12.16
KB
-rw-r--r--
2024-03-19 22:46
thread_pthread.h
25.32
KB
-rw-r--r--
2024-03-19 22:46
traceback.c
25.55
KB
-rw-r--r--
2024-03-19 22:46
traceback.gcda
8.3
KB
-rw-r--r--
2025-06-04 09:21
traceback.o
169.99
KB
-rw-r--r--
2025-06-04 09:22
wordcode_helpers.h
1.25
KB
-rw-r--r--
2024-03-19 22:46
Save
Rename
#include "pycore_interp.h" // _PyInterpreterState.pythread_stacksize /* This code implemented by Dag.Gruneau@elsa.preseco.comm.se */ /* Fast NonRecursiveMutex support by Yakov Markovitch, markovitch@iso.ru */ /* Eliminated some memory leaks, gsw@agere.com */ #include <windows.h> #include <limits.h> #ifdef HAVE_PROCESS_H #include <process.h> #endif /* options */ #ifndef _PY_USE_CV_LOCKS #define _PY_USE_CV_LOCKS 1 /* use locks based on cond vars */ #endif /* Now, define a non-recursive mutex using either condition variables * and critical sections (fast) or using operating system mutexes * (slow) */ #if _PY_USE_CV_LOCKS #include "condvar.h" typedef struct _NRMUTEX { PyMUTEX_T cs; PyCOND_T cv; int locked; } NRMUTEX; typedef NRMUTEX *PNRMUTEX; PNRMUTEX AllocNonRecursiveMutex() { PNRMUTEX m = (PNRMUTEX)PyMem_RawMalloc(sizeof(NRMUTEX)); if (!m) return NULL; if (PyCOND_INIT(&m->cv)) goto fail; if (PyMUTEX_INIT(&m->cs)) { PyCOND_FINI(&m->cv); goto fail; } m->locked = 0; return m; fail: PyMem_RawFree(m); return NULL; } VOID FreeNonRecursiveMutex(PNRMUTEX mutex) { if (mutex) { PyCOND_FINI(&mutex->cv); PyMUTEX_FINI(&mutex->cs); PyMem_RawFree(mutex); } } DWORD EnterNonRecursiveMutex(PNRMUTEX mutex, DWORD milliseconds) { DWORD result = WAIT_OBJECT_0; if (PyMUTEX_LOCK(&mutex->cs)) return WAIT_FAILED; if (milliseconds == INFINITE) { while (mutex->locked) { if (PyCOND_WAIT(&mutex->cv, &mutex->cs)) { result = WAIT_FAILED; break; } } } else if (milliseconds != 0) { /* wait at least until the target */ _PyTime_t now = _PyTime_GetPerfCounter(); if (now <= 0) { Py_FatalError("_PyTime_GetPerfCounter() == 0"); } _PyTime_t nanoseconds = _PyTime_FromNanoseconds((_PyTime_t)milliseconds * 1000000); _PyTime_t target = now + nanoseconds; while (mutex->locked) { _PyTime_t microseconds = _PyTime_AsMicroseconds(nanoseconds, _PyTime_ROUND_TIMEOUT); if (PyCOND_TIMEDWAIT(&mutex->cv, &mutex->cs, microseconds) < 0) { result = WAIT_FAILED; break; } now = _PyTime_GetPerfCounter(); if (target <= now) break; nanoseconds = target - now; } } if (!mutex->locked) { mutex->locked = 1; result = WAIT_OBJECT_0; } else if (result == WAIT_OBJECT_0) result = WAIT_TIMEOUT; /* else, it is WAIT_FAILED */ PyMUTEX_UNLOCK(&mutex->cs); /* must ignore result here */ return result; } BOOL LeaveNonRecursiveMutex(PNRMUTEX mutex) { BOOL result; if (PyMUTEX_LOCK(&mutex->cs)) return FALSE; mutex->locked = 0; /* condvar APIs return 0 on success. We need to return TRUE on success. */ result = !PyCOND_SIGNAL(&mutex->cv); PyMUTEX_UNLOCK(&mutex->cs); return result; } #else /* if ! _PY_USE_CV_LOCKS */ /* NR-locks based on a kernel mutex */ #define PNRMUTEX HANDLE PNRMUTEX AllocNonRecursiveMutex() { return CreateSemaphore(NULL, 1, 1, NULL); } VOID FreeNonRecursiveMutex(PNRMUTEX mutex) { /* No in-use check */ CloseHandle(mutex); } DWORD EnterNonRecursiveMutex(PNRMUTEX mutex, DWORD milliseconds) { return WaitForSingleObjectEx(mutex, milliseconds, FALSE); } BOOL LeaveNonRecursiveMutex(PNRMUTEX mutex) { return ReleaseSemaphore(mutex, 1, NULL); } #endif /* _PY_USE_CV_LOCKS */ unsigned long PyThread_get_thread_ident(void); #ifdef PY_HAVE_THREAD_NATIVE_ID unsigned long PyThread_get_thread_native_id(void); #endif /* * Initialization of the C package, should not be needed. */ static void PyThread__init_thread(void) { } /* * Thread support. */ typedef struct { void (*func)(void*); void *arg; } callobj; /* thunker to call adapt between the function type used by the system's thread start function and the internally used one. */ static unsigned __stdcall bootstrap(void *call) { callobj *obj = (callobj*)call; void (*func)(void*) = obj->func; void *arg = obj->arg; HeapFree(GetProcessHeap(), 0, obj); func(arg); return 0; } unsigned long PyThread_start_new_thread(void (*func)(void *), void *arg) { HANDLE hThread; unsigned threadID; callobj *obj; dprintf(("%lu: PyThread_start_new_thread called\n", PyThread_get_thread_ident())); if (!initialized) PyThread_init_thread(); obj = (callobj*)HeapAlloc(GetProcessHeap(), 0, sizeof(*obj)); if (!obj) return PYTHREAD_INVALID_THREAD_ID; obj->func = func; obj->arg = arg; PyThreadState *tstate = _PyThreadState_GET(); size_t stacksize = tstate ? tstate->interp->pythread_stacksize : 0; hThread = (HANDLE)_beginthreadex(0, Py_SAFE_DOWNCAST(stacksize, Py_ssize_t, unsigned int), bootstrap, obj, 0, &threadID); if (hThread == 0) { /* I've seen errno == EAGAIN here, which means "there are * 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; } /* * Return the thread Id instead of a handle. The Id is said to uniquely identify the * thread in the system */ unsigned long PyThread_get_thread_ident(void) { if (!initialized) PyThread_init_thread(); return GetCurrentThreadId(); } #ifdef PY_HAVE_THREAD_NATIVE_ID /* * Return the native Thread ID (TID) of the calling thread. * The native ID of a thread is valid and guaranteed to be unique system-wide * from the time the thread is created until the thread has been terminated. */ unsigned long PyThread_get_thread_native_id(void) { if (!initialized) { PyThread_init_thread(); } DWORD native_id; native_id = GetCurrentThreadId(); return (unsigned long) native_id; } #endif 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); } /* * Lock support. It has to be implemented as semaphores. * I [Dag] tried to implement it with mutex but I could find a way to * tell whether a thread already own the lock or not. */ PyThread_type_lock PyThread_allocate_lock(void) { PNRMUTEX aLock; dprintf(("PyThread_allocate_lock called\n")); if (!initialized) PyThread_init_thread(); aLock = AllocNonRecursiveMutex() ; dprintf(("%lu: PyThread_allocate_lock() -> %p\n", PyThread_get_thread_ident(), aLock)); return (PyThread_type_lock) aLock; } void PyThread_free_lock(PyThread_type_lock aLock) { dprintf(("%lu: PyThread_free_lock(%p) called\n", PyThread_get_thread_ident(),aLock)); FreeNonRecursiveMutex(aLock) ; } /* * Return 1 on success if the lock was acquired * * and 0 if the lock was not acquired. This means a 0 is returned * if the lock has already been acquired by this thread! */ PyLockStatus PyThread_acquire_lock_timed(PyThread_type_lock aLock, PY_TIMEOUT_T microseconds, int intr_flag) { /* Fow now, intr_flag does nothing on Windows, and lock acquires are * uninterruptible. */ PyLockStatus success; PY_TIMEOUT_T milliseconds; if (microseconds >= 0) { milliseconds = microseconds / 1000; if (microseconds % 1000 > 0) ++milliseconds; if (milliseconds > PY_DWORD_MAX) { Py_FatalError("Timeout larger than PY_TIMEOUT_MAX"); } } else { 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) { 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 PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag) { return PyThread_acquire_lock_timed(aLock, waitflag ? -1 : 0, 0); } 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())); } /* minimum/maximum thread stack sizes supported */ #define THREAD_MIN_STACKSIZE 0x8000 /* 32 KiB */ #define THREAD_MAX_STACKSIZE 0x10000000 /* 256 MiB */ /* set the thread stack size. * Return 0 if size is valid, -1 otherwise. */ static int _pythread_nt_set_stacksize(size_t size) { /* set to default */ if (size == 0) { _PyInterpreterState_GET()->pythread_stacksize = 0; return 0; } /* valid range? */ if (size >= THREAD_MIN_STACKSIZE && size < THREAD_MAX_STACKSIZE) { _PyInterpreterState_GET()->pythread_stacksize = size; return 0; } return -1; } #define THREAD_SET_STACKSIZE(x) _pythread_nt_set_stacksize(x) /* Thread Local Storage (TLS) API This API is DEPRECATED since Python 3.7. See PEP 539 for details. */ int PyThread_create_key(void) { DWORD result = TlsAlloc(); if (result == TLS_OUT_OF_INDEXES) return -1; return (int)result; } void PyThread_delete_key(int key) { TlsFree(key); } int PyThread_set_key_value(int key, void *value) { BOOL ok = TlsSetValue(key, value); return ok ? 0 : -1; } void * PyThread_get_key_value(int key) { /* because TLS is used in the Py_END_ALLOW_THREAD macro, * it is necessary to preserve the windows error state, because * it is assumed to be preserved across the call to the macro. * Ideally, the macro should be fixed, but it is simpler to * do it here. */ DWORD error = GetLastError(); void *result = TlsGetValue(key); SetLastError(error); return result; } void PyThread_delete_key_value(int key) { /* NULL is used as "key missing", and it is also the default * given by TlsGetValue() if nothing has been set yet. */ TlsSetValue(key, NULL); } /* reinitialization of TLS is not necessary after fork when using * the native TLS functions. And forking isn't supported on Windows either. */ void PyThread_ReInitTLS(void) { } /* Thread Specific Storage (TSS) API Platform-specific components of TSS API implementation. */ int PyThread_tss_create(Py_tss_t *key) { assert(key != NULL); /* If the key has been created, function is silently skipped. */ if (key->_is_initialized) { return 0; } DWORD result = TlsAlloc(); if (result == TLS_OUT_OF_INDEXES) { return -1; } /* In Windows, platform-specific key type is DWORD. */ key->_key = result; key->_is_initialized = 1; return 0; } void PyThread_tss_delete(Py_tss_t *key) { assert(key != NULL); /* If the key has not been created, function is silently skipped. */ if (!key->_is_initialized) { return; } TlsFree(key->_key); key->_key = TLS_OUT_OF_INDEXES; key->_is_initialized = 0; } int PyThread_tss_set(Py_tss_t *key, void *value) { assert(key != NULL); BOOL ok = TlsSetValue(key->_key, value); return ok ? 0 : -1; } void * PyThread_tss_get(Py_tss_t *key) { assert(key != NULL); /* because TSS is used in the Py_END_ALLOW_THREAD macro, * it is necessary to preserve the windows error state, because * it is assumed to be preserved across the call to the macro. * Ideally, the macro should be fixed, but it is simpler to * do it here. */ DWORD error = GetLastError(); void *result = TlsGetValue(key->_key); SetLastError(error); return result; }