Commit 07115e3f authored by sonots's avatar sonots

Add TSS (Thread Specific Storage) API in CPython 3.7+

parent 0331c8d0
...@@ -29,7 +29,7 @@ cdef extern from "pythread.h": ...@@ -29,7 +29,7 @@ cdef extern from "pythread.h":
size_t PyThread_get_stacksize() size_t PyThread_get_stacksize()
int PyThread_set_stacksize(size_t) int PyThread_set_stacksize(size_t)
# Thread Local Storage (TLS) API # Thread Local Storage (TLS) API deprecated in CPython 3.7+
int PyThread_create_key() int PyThread_create_key()
void PyThread_delete_key(int) void PyThread_delete_key(int)
int PyThread_set_key_value(int, void *) int PyThread_set_key_value(int, void *)
...@@ -38,3 +38,15 @@ cdef extern from "pythread.h": ...@@ -38,3 +38,15 @@ cdef extern from "pythread.h":
# Cleanup after a fork # Cleanup after a fork
void PyThread_ReInitTLS() void PyThread_ReInitTLS()
# Thread Specific Storage (TSS) API in CPython 3.7+
ctypedef struct Py_tss_t:
pass
Py_tss_t Py_tss_NEEDS_INIT
Py_tss_t * PyThread_tss_alloc()
void PyThread_tss_free(Py_tss_t *key)
int PyThread_tss_is_created(Py_tss_t *key)
int PyThread_tss_create(Py_tss_t *key)
void PyThread_tss_delete(Py_tss_t *key)
int PyThread_tss_set(Py_tss_t *key, void *value)
void * PyThread_tss_get(Py_tss_t *key)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment