3
cdef extern from "pythread.h":
5
ctypedef void *PyThread_type_lock
6
ctypedef void *PyThread_type_sema
8
void PyThread_init_thread()
9
long PyThread_start_new_thread(void (*)(void *), void *) # FIXME: legacy
10
#unsigned long PyThread_start_new_thread(void (*)(void *), void *) # returned 'long' before Py3.7
11
void PyThread_exit_thread()
12
long PyThread_get_thread_ident() # FIXME: legacy
13
#unsigned long PyThread_get_thread_ident() # returned 'long' before Py3.7
15
PyThread_type_lock PyThread_allocate_lock()
16
void PyThread_free_lock(PyThread_type_lock)
17
int PyThread_acquire_lock(PyThread_type_lock, int mode) nogil
18
void PyThread_release_lock(PyThread_type_lock) nogil
21
# 'mode' in PyThread_acquire_lock()
25
ctypedef enum PyLockStatus:
26
# return values of PyThread_acquire_lock() in CPython 3.2+
31
size_t PyThread_get_stacksize()
32
int PyThread_set_stacksize(size_t)
34
# Thread Local Storage (TLS) API deprecated in CPython 3.7+
35
int PyThread_create_key()
36
void PyThread_delete_key(int)
37
int PyThread_set_key_value(int, void *)
38
void * PyThread_get_key_value(int)
39
void PyThread_delete_key_value(int key)
41
# Cleanup after a fork
42
void PyThread_ReInitTLS()
44
# Thread Specific Storage (TSS) API in CPython 3.7+ (also backported)
45
#ctypedef struct Py_tss_t: pass # Cython built-in type
46
Py_tss_t Py_tss_NEEDS_INIT # Not normally useful: Cython auto-initialises declared "Py_tss_t" variables.
47
Py_tss_t * PyThread_tss_alloc()
48
void PyThread_tss_free(Py_tss_t *key)
49
int PyThread_tss_is_created(Py_tss_t *key)
50
int PyThread_tss_create(Py_tss_t *key)
51
void PyThread_tss_delete(Py_tss_t *key)
52
int PyThread_tss_set(Py_tss_t *key, void *value)
53
void * PyThread_tss_get(Py_tss_t *key)