File indexing completed on 2025-11-19 09:50:55
0001 #ifndef Py_PYTHREAD_H
0002 #define Py_PYTHREAD_H
0003
0004 typedef void *PyThread_type_lock;
0005
0006 #ifdef __cplusplus
0007 extern "C" {
0008 #endif
0009
0010
0011
0012 typedef enum PyLockStatus {
0013 PY_LOCK_FAILURE = 0,
0014 PY_LOCK_ACQUIRED = 1,
0015 PY_LOCK_INTR
0016 } PyLockStatus;
0017
0018 PyAPI_FUNC(void) PyThread_init_thread(void);
0019 PyAPI_FUNC(unsigned long) PyThread_start_new_thread(void (*)(void *), void *);
0020 PyAPI_FUNC(void) _Py_NO_RETURN PyThread_exit_thread(void);
0021 PyAPI_FUNC(unsigned long) PyThread_get_thread_ident(void);
0022
0023 #if (defined(__APPLE__) || defined(__linux__) || defined(_WIN32) \
0024 || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \
0025 || defined(__OpenBSD__) || defined(__NetBSD__) \
0026 || defined(__DragonFly__) || defined(_AIX))
0027 #define PY_HAVE_THREAD_NATIVE_ID
0028 PyAPI_FUNC(unsigned long) PyThread_get_thread_native_id(void);
0029 #endif
0030
0031 PyAPI_FUNC(PyThread_type_lock) PyThread_allocate_lock(void);
0032 PyAPI_FUNC(void) PyThread_free_lock(PyThread_type_lock);
0033 PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int);
0034 #define WAIT_LOCK 1
0035 #define NOWAIT_LOCK 0
0036
0037
0038
0039 #define PY_TIMEOUT_T long long
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054 PyAPI_FUNC(PyLockStatus) PyThread_acquire_lock_timed(PyThread_type_lock,
0055 PY_TIMEOUT_T microseconds,
0056 int intr_flag);
0057
0058 PyAPI_FUNC(void) PyThread_release_lock(PyThread_type_lock);
0059
0060 PyAPI_FUNC(size_t) PyThread_get_stacksize(void);
0061 PyAPI_FUNC(int) PyThread_set_stacksize(size_t);
0062
0063 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
0064 PyAPI_FUNC(PyObject*) PyThread_GetInfo(void);
0065 #endif
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075 Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_create_key(void);
0076 Py_DEPRECATED(3.7) PyAPI_FUNC(void) PyThread_delete_key(int key);
0077 Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_set_key_value(int key,
0078 void *value);
0079 Py_DEPRECATED(3.7) PyAPI_FUNC(void *) PyThread_get_key_value(int key);
0080 Py_DEPRECATED(3.7) PyAPI_FUNC(void) PyThread_delete_key_value(int key);
0081
0082
0083 Py_DEPRECATED(3.7) PyAPI_FUNC(void) PyThread_ReInitTLS(void);
0084
0085
0086 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000
0087
0088
0089
0090 typedef struct _Py_tss_t Py_tss_t;
0091
0092 PyAPI_FUNC(Py_tss_t *) PyThread_tss_alloc(void);
0093 PyAPI_FUNC(void) PyThread_tss_free(Py_tss_t *key);
0094
0095
0096 PyAPI_FUNC(int) PyThread_tss_is_created(Py_tss_t *key);
0097 PyAPI_FUNC(int) PyThread_tss_create(Py_tss_t *key);
0098 PyAPI_FUNC(void) PyThread_tss_delete(Py_tss_t *key);
0099 PyAPI_FUNC(int) PyThread_tss_set(Py_tss_t *key, void *value);
0100 PyAPI_FUNC(void *) PyThread_tss_get(Py_tss_t *key);
0101 #endif
0102
0103 #ifndef Py_LIMITED_API
0104 # define Py_CPYTHON_PYTHREAD_H
0105 # include "cpython/pythread.h"
0106 # undef Py_CPYTHON_PYTHREAD_H
0107 #endif
0108
0109 #ifdef __cplusplus
0110 }
0111 #endif
0112 #endif