Skip to content

Commit f4ea30d

Browse files
Add _PyEval_AcquireLock().
1 parent 7781268 commit f4ea30d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Include/internal/pycore_ceval.h

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ extern int _PyEval_ThreadsInitialized(void);
100100
extern PyStatus _PyEval_InitGIL(PyThreadState *tstate, int own_gil);
101101
extern void _PyEval_FiniGIL(PyInterpreterState *interp);
102102

103+
extern void _PyEval_AcquireLock(PyThreadState *tstate);
103104
extern void _PyEval_ReleaseLock(PyThreadState *tstate);
104105

105106
extern void _PyEval_DeactivateOpCache(void);

Python/ceval_gil.c

+8
Original file line numberDiff line numberDiff line change
@@ -609,9 +609,17 @@ PyEval_ReleaseLock(void)
609609
drop_gil(ceval, tstate);
610610
}
611611

612+
void
613+
_PyEval_AcquireLock(PyThreadState *tstate)
614+
{
615+
_Py_EnsureTstateNotNULL(tstate);
616+
take_gil(tstate);
617+
}
618+
612619
void
613620
_PyEval_ReleaseLock(PyThreadState *tstate)
614621
{
622+
_Py_EnsureTstateNotNULL(tstate);
615623
struct _ceval_state *ceval = &tstate->interp->ceval;
616624
drop_gil(ceval, tstate);
617625
}

0 commit comments

Comments
 (0)