File indexing completed on 2025-01-18 10:06:44
0001 #ifndef Py_INTERNAL_GIL_H
0002 #define Py_INTERNAL_GIL_H
0003 #ifdef __cplusplus
0004 extern "C" {
0005 #endif
0006
0007 #ifndef Py_BUILD_CORE
0008 # error "this header requires Py_BUILD_CORE define"
0009 #endif
0010
0011 #include "pycore_atomic.h" /* _Py_atomic_address */
0012 #include "pycore_condvar.h" /* PyCOND_T */
0013
0014 #ifndef Py_HAVE_CONDVAR
0015 # error You need either a POSIX-compatible or a Windows system!
0016 #endif
0017
0018
0019
0020 #undef FORCE_SWITCHING
0021 #define FORCE_SWITCHING
0022
0023 struct _gil_runtime_state {
0024
0025 unsigned long interval;
0026
0027
0028 _Py_atomic_address last_holder;
0029
0030
0031 _Py_atomic_int locked;
0032
0033 unsigned long switch_number;
0034
0035
0036
0037 PyCOND_T cond;
0038 PyMUTEX_T mutex;
0039 #ifdef FORCE_SWITCHING
0040
0041
0042 PyCOND_T switch_cond;
0043 PyMUTEX_T switch_mutex;
0044 #endif
0045 };
0046
0047 #ifdef __cplusplus
0048 }
0049 #endif
0050 #endif