1-
21#ifndef Py_PYTHREAD_H
32#define Py_PYTHREAD_H
43
@@ -16,10 +15,6 @@ typedef enum PyLockStatus {
1615 PY_LOCK_INTR
1716} PyLockStatus ;
1817
19- #ifndef Py_LIMITED_API
20- #define PYTHREAD_INVALID_THREAD_ID ((unsigned long)-1)
21- #endif
22-
2318PyAPI_FUNC (void ) PyThread_init_thread (void );
2419PyAPI_FUNC (unsigned long ) PyThread_start_new_thread (void (* )(void * ), void * );
2520PyAPI_FUNC (void ) _Py_NO_RETURN PyThread_exit_thread (void );
@@ -36,15 +31,6 @@ PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int);
3631#define WAIT_LOCK 1
3732#define NOWAIT_LOCK 0
3833
39- #ifndef Py_LIMITED_API
40- #ifdef HAVE_FORK
41- /* Private function to reinitialize a lock at fork in the child process.
42- Reset the lock to the unlocked state.
43- Return 0 on success, return -1 on error. */
44- PyAPI_FUNC (int ) _PyThread_at_fork_reinit (PyThread_type_lock * lock );
45- #endif /* HAVE_FORK */
46- #endif /* !Py_LIMITED_API */
47-
4834/* PY_TIMEOUT_T is the integral type used to specify timeouts when waiting
4935 on a lock (see PyThread_acquire_lock_timed() below).
5036 PY_TIMEOUT_MAX is the highest usable value (in microseconds) of that
@@ -124,35 +110,6 @@ Py_DEPRECATED(3.7) PyAPI_FUNC(void) PyThread_ReInitTLS(void);
124110
125111typedef struct _Py_tss_t Py_tss_t ; /* opaque */
126112
127- #ifndef Py_LIMITED_API
128- #ifdef HAVE_PTHREAD_H
129- /* Darwin needs pthread.h to know type name the pthread_key_t. */
130- # include <pthread.h>
131- # define NATIVE_TSS_KEY_T pthread_key_t
132- #elif defined(NT_THREADS )
133- /* In Windows, native TSS key type is DWORD,
134- but hardcode the unsigned long to avoid errors for include directive.
135- */
136- # define NATIVE_TSS_KEY_T unsigned long
137- #else
138- # error "Require native threads. See https://bugs.python.org/issue31370"
139- #endif
140-
141- /* When Py_LIMITED_API is not defined, the type layout of Py_tss_t is
142- exposed to allow static allocation in the API clients. Even in this case,
143- you must handle TSS keys through API functions due to compatibility.
144- */
145- struct _Py_tss_t {
146- int _is_initialized ;
147- NATIVE_TSS_KEY_T _key ;
148- };
149-
150- #undef NATIVE_TSS_KEY_T
151-
152- /* When static allocation, you must initialize with Py_tss_NEEDS_INIT. */
153- #define Py_tss_NEEDS_INIT {0}
154- #endif /* !Py_LIMITED_API */
155-
156113PyAPI_FUNC (Py_tss_t * ) PyThread_tss_alloc (void );
157114PyAPI_FUNC (void ) PyThread_tss_free (Py_tss_t * key );
158115
@@ -164,8 +121,13 @@ PyAPI_FUNC(int) PyThread_tss_set(Py_tss_t *key, void *value);
164121PyAPI_FUNC (void * ) PyThread_tss_get (Py_tss_t * key );
165122#endif /* New in 3.7 */
166123
124+ #ifndef Py_LIMITED_API
125+ # define Py_CPYTHON_PYTHREAD_H
126+ # include "cpython/pythread.h"
127+ # undef Py_CPYTHON_PYTHREAD_H
128+ #endif
129+
167130#ifdef __cplusplus
168131}
169132#endif
170-
171133#endif /* !Py_PYTHREAD_H */
0 commit comments