| #ifndef Py_INTERNAL_GIL_H |
| #define Py_INTERNAL_GIL_H |
| #ifdef __cplusplus |
| extern "C" { |
| #endif |
|
|
| #ifndef Py_BUILD_CORE |
| # error "this header requires Py_BUILD_CORE define" |
| #endif |
|
|
| #include "pycore_atomic.h" |
| #include "pycore_condvar.h" |
|
|
| #ifndef Py_HAVE_CONDVAR |
| # error You need either a POSIX-compatible or a Windows system! |
| #endif |
|
|
| |
| |
| #undef FORCE_SWITCHING |
| #define FORCE_SWITCHING |
|
|
| struct _gil_runtime_state { |
| |
| unsigned long interval; |
| |
| |
| _Py_atomic_address last_holder; |
| |
| |
| _Py_atomic_int locked; |
| |
| unsigned long switch_number; |
| |
| |
| |
| PyCOND_T cond; |
| PyMUTEX_T mutex; |
| #ifdef FORCE_SWITCHING |
| |
| |
| PyCOND_T switch_cond; |
| PyMUTEX_T switch_mutex; |
| #endif |
| }; |
|
|
| #ifdef __cplusplus |
| } |
| #endif |
| #endif |
|
|