Debian Codegraph @

Include/internal/pycore_tstate.h

raw
1 #ifndef Py_INTERNAL_TSTATE_H
2 #define Py_INTERNAL_TSTATE_H
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6
7 #ifndef Py_BUILD_CORE
8 # error "this header requires Py_BUILD_CORE define"
9 #endif
10
11 #include "pycore_brc.h" // struct _brc_thread_state
12 #include "pycore_freelist.h" // struct _Py_freelist_state
13 #include "pycore_mimalloc.h" // struct _mimalloc_thread_state
14 #include "pycore_qsbr.h" // struct qsbr
15
16
17 // Every PyThreadState is actually allocated as a _PyThreadStateImpl. The
18 // PyThreadState fields are exposed as part of the C API, although most fields
19 // are intended to be private. The _PyThreadStateImpl fields not exposed.
20 typedef struct _PyThreadStateImpl {
21 // semi-public fields are in PyThreadState.
22 PyThreadState base;
23
24 PyObject *asyncio_running_loop; // Strong reference
25
26 struct _qsbr_thread_state *qsbr; // only used by free-threaded build
27 struct llist_node mem_free_queue; // delayed free queue
28
29 #ifdef Py_GIL_DISABLED
30 struct _gc_thread_state gc;
31 struct _mimalloc_thread_state mimalloc;
32 struct _Py_object_freelists freelists;
33 struct _brc_thread_state brc;
34 #endif
35
36 #if defined(Py_REF_DEBUG) && defined(Py_GIL_DISABLED)
37 Py_ssize_t reftotal; // this thread's total refcount operations
38 #endif
39
40 } _PyThreadStateImpl;
41
42
43 #ifdef __cplusplus
44 }
45 #endif
46 #endif /* !Py_INTERNAL_TSTATE_H */