Debian Codegraph @

Include/internal/pycore_index_pool.h

raw
1 #ifndef Py_INTERNAL_INDEX_POOL_H
2 #define Py_INTERNAL_INDEX_POOL_H
3
4 #include "Python.h"
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9
10 #ifndef Py_BUILD_CORE
11 # error "this header requires Py_BUILD_CORE define"
12 #endif
13
14 #ifdef Py_GIL_DISABLED
15
16 #include "pycore_interp_structs.h"
17
18 // This contains code for allocating unique indices in an array. It is used by
19 // the free-threaded build to assign each thread a globally unique index into
20 // each code object's thread-local bytecode array.
21
22
23 // Allocate the smallest available index. Returns -1 on error.
24 extern int32_t _PyIndexPool_AllocIndex(_PyIndexPool *indices);
25
26 // Release `index` back to the pool
27 extern void _PyIndexPool_FreeIndex(_PyIndexPool *indices, int32_t index);
28
29 extern void _PyIndexPool_Fini(_PyIndexPool *indices);
30
31 #endif // Py_GIL_DISABLED
32
33 #ifdef __cplusplus
34 }
35 #endif
36 #endif // !Py_INTERNAL_INDEX_POOL_H