Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:06:41

0001 #ifndef Py_CPYTHON_PYTHREAD_H
0002 #  error "this header file must not be included directly"
0003 #endif
0004 
0005 #define PYTHREAD_INVALID_THREAD_ID ((unsigned long)-1)
0006 
0007 #ifdef HAVE_FORK
0008 /* Private function to reinitialize a lock at fork in the child process.
0009    Reset the lock to the unlocked state.
0010    Return 0 on success, return -1 on error. */
0011 PyAPI_FUNC(int) _PyThread_at_fork_reinit(PyThread_type_lock *lock);
0012 #endif  /* HAVE_FORK */
0013 
0014 #ifdef HAVE_PTHREAD_H
0015     /* Darwin needs pthread.h to know type name the pthread_key_t. */
0016 #   include <pthread.h>
0017 #   define NATIVE_TSS_KEY_T     pthread_key_t
0018 #elif defined(NT_THREADS)
0019     /* In Windows, native TSS key type is DWORD,
0020        but hardcode the unsigned long to avoid errors for include directive.
0021     */
0022 #   define NATIVE_TSS_KEY_T     unsigned long
0023 #elif defined(HAVE_PTHREAD_STUBS)
0024 #   include "cpython/pthread_stubs.h"
0025 #   define NATIVE_TSS_KEY_T     pthread_key_t
0026 #else
0027 #   error "Require native threads. See https://bugs.python.org/issue31370"
0028 #endif
0029 
0030 /* When Py_LIMITED_API is not defined, the type layout of Py_tss_t is
0031    exposed to allow static allocation in the API clients.  Even in this case,
0032    you must handle TSS keys through API functions due to compatibility.
0033 */
0034 struct _Py_tss_t {
0035     int _is_initialized;
0036     NATIVE_TSS_KEY_T _key;
0037 };
0038 
0039 #undef NATIVE_TSS_KEY_T
0040 
0041 /* When static allocation, you must initialize with Py_tss_NEEDS_INIT. */
0042 #define Py_tss_NEEDS_INIT   {0}