Skip to content

Commit b331603

Browse files
committed
Comments
1 parent 7632738 commit b331603

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

org.lflang/src/lib/Python/pythontarget.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,8 +981,13 @@ get_python_function(string module, string class, int instance_id, string func) {
981981

982982
PyObject *rValue;
983983

984-
985-
984+
// According to
985+
// https://docs.python.org/3/c-api/init.html#non-python-created-threads
986+
// the following code does the following:
987+
// - Register this thread with the interpreter
988+
// - Acquire the GIL (Global Interpreter Lock)
989+
// - Store (return) the thread pointer
990+
// When done, we should always call PyGILState_Release(gstate);
986991
PyGILState_STATE gstate;
987992
gstate = PyGILState_Ensure();
988993

0 commit comments

Comments
 (0)