Skip to content

Commit 3a7f9dc

Browse files
committed
Add Sulong implementation of PyGILState_Ensure
1 parent 075412b commit 3a7f9dc

File tree

1 file changed

+13
-0
lines changed
  • graalpython/com.oracle.graal.python.cext/src

1 file changed

+13
-0
lines changed

graalpython/com.oracle.graal.python.cext/src/pystate.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,16 @@ int PyState_RemoveModule(struct PyModuleDef* def) {
115115
// TODO(fa): implement
116116
return 0;
117117
}
118+
119+
// This function has a different implementation on NFI in capi_native.c
120+
PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure() {
121+
int res = GraalPyTruffleGILState_Ensure();
122+
return res ? PyGILState_LOCKED : PyGILState_UNLOCKED;
123+
}
124+
125+
// This function has a different implementation on NFI in capi_native.c
126+
PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE state) {
127+
if (state == PyGILState_LOCKED) {
128+
GraalPyTruffleGILState_Release();
129+
}
130+
}

0 commit comments

Comments
 (0)