Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-19 09:50:42

0001 #ifndef Py_CPYTHON_PYTHREAD_H
0002 #  error "this header file must not be included directly"
0003 #endif
0004 
0005 // PY_TIMEOUT_MAX is the highest usable value (in microseconds) of PY_TIMEOUT_T
0006 // type, and depends on the system threading API.
0007 //
0008 // NOTE: this isn't the same value as `_thread.TIMEOUT_MAX`. The _thread module
0009 // exposes a higher-level API, with timeouts expressed in seconds and
0010 // floating-point numbers allowed.
0011 PyAPI_DATA(const long long) PY_TIMEOUT_MAX;
0012 
0013 #define PYTHREAD_INVALID_THREAD_ID ((unsigned long)-1)
0014 
0015 #ifdef HAVE_PTHREAD_H
0016     /* Darwin needs pthread.h to know type name the pthread_key_t. */
0017 #   include <pthread.h>
0018 #   define NATIVE_TSS_KEY_T     pthread_key_t
0019 #elif defined(NT_THREADS)
0020     /* In Windows, native TSS key type is DWORD,
0021        but hardcode the unsigned long to avoid errors for include directive.
0022     */
0023 #   define NATIVE_TSS_KEY_T     unsigned long
0024 #elif defined(HAVE_PTHREAD_STUBS)
0025 #   include "pthread_stubs.h"
0026 #   define NATIVE_TSS_KEY_T     pthread_key_t
0027 #else
0028 #   error "Require native threads. See https://bugs.python.org/issue31370"
0029 #endif
0030 
0031 /* When Py_LIMITED_API is not defined, the type layout of Py_tss_t is
0032    exposed to allow static allocation in the API clients.  Even in this case,
0033    you must handle TSS keys through API functions due to compatibility.
0034 */
0035 struct _Py_tss_t {
0036     int _is_initialized;
0037     NATIVE_TSS_KEY_T _key;
0038 };
0039 
0040 #undef NATIVE_TSS_KEY_T
0041 
0042 /* When static allocation, you must initialize with Py_tss_NEEDS_INIT. */
0043 #define Py_tss_NEEDS_INIT   {0}