File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,8 @@ struct _is {
139139 or the size specified by the THREAD_STACK_SIZE macro. */
140140 /* Used in Python/thread.c. */
141141 size_t stacksize ;
142+ /* The mutex lock of the current executing thread. */
143+ PyMutex mutex ;
142144 } threads ;
143145
144146 /* Reference to the _PyRuntime global variable. This field exists
Original file line number Diff line number Diff line change @@ -263,6 +263,11 @@ extern int _PyOS_InterruptOccurred(PyThreadState *tstate);
263263#define HEAD_UNLOCK (runtime ) \
264264 PyMutex_Unlock(&(runtime)->interpreters.mutex)
265265
266+ #define INTERP_THREAD_LOCK (interpstate ) \
267+ PyMutex_LockFlags(&(interpstate)->threads.mutex, _Py_LOCK_DONT_DETACH)
268+ #define INTERP_THREAD_UNLOCK (interpstate ) \
269+ PyMutex_Unlock(&(interpstate)->threads.mutex)
270+
266271// Get the configuration of the current interpreter.
267272// The caller must hold the GIL.
268273// Export for test_peg_generator.
You can’t perform that action at this time.
0 commit comments