Skip to content

Commit 0eed2c2

Browse files
libvortex-1.1:
* [fix] Updated CLOSE_HANDLE (py_vortex_ctx_record_close_handler) to release GIL while searching for watcher handler and removing it after finishing recording....
1 parent 3592f7a commit 0eed2c2

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

py-vortex/src/py_vortex_ctx.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,22 @@ void py_vortex_ctx_record_start_handler (VortexCtx * ctx, PyObject * hand
145145

146146
void py_vortex_ctx_record_close_handler (VortexCtx * ctx, PyObject * handler)
147147
{
148-
VortexHash * hash = vortex_ctx_get_data (ctx, PY_VORTEX_WATCHER_HANDLER_HASH);
148+
VortexHash * hash;
149+
150+
/* allow other threads to enter into the python space */
151+
Py_BEGIN_ALLOW_THREADS
149152

150153
/* no hash no record */
151-
if (hash == NULL)
152-
return;
154+
hash = vortex_ctx_get_data (ctx, PY_VORTEX_WATCHER_HANDLER_HASH);
155+
156+
if (hash) {
157+
/* delete handler */
158+
vortex_hash_remove (hash, handler);
159+
} /* end if */
160+
161+
/* restore thread state */
162+
Py_END_ALLOW_THREADS
153163

154-
/* delete handler */
155-
vortex_hash_remove (hash, handler);
156164
return;
157165
}
158166

0 commit comments

Comments
 (0)