Skip to content

Commit 121ae40

Browse files
committed
MAINT: Move locks to encircle only global dicts
1 parent eff9a92 commit 121ae40

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/watchdog_fsevents.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -743,13 +743,13 @@ watchdog_read_events(PyObject *self, PyObject *args)
743743
if (G_IS_NULL(value))
744744
{
745745
run_loop_ref = CFRunLoopGetCurrent();
746-
LOCK_GDATA_MUTEX;
747746
value = PyCapsule_New(run_loop_ref, NULL, watchdog_pycapsule_destructor);
748-
UNLOCK_GDATA_MUTEX;
747+
LOCK_GDATA_MUTEX;
749748
if (PyDict_SetItem(thread_to_run_loop, emitter_thread, value) < 0) {
750749
Py_DECREF(value);
751750
return NULL;
752751
}
752+
UNLOCK_GDATA_MUTEX;
753753
Py_INCREF(emitter_thread);
754754
}
755755

@@ -841,9 +841,8 @@ watchdog_stop(PyObject *self, PyObject *emitter_thread)
841841
{
842842
UNUSED(self);
843843
PyObject *value = NULL;
844-
int val_ind = 0;
845844
LOCK_GDATA_MUTEX;
846-
val_ind = PyDict_GetItemRef(thread_to_run_loop, emitter_thread, &value);
845+
PyDict_GetItemRef(thread_to_run_loop, emitter_thread, &value);
847846
UNLOCK_GDATA_MUTEX;
848847
if (G_IS_NULL(value)) {
849848
goto success;

0 commit comments

Comments
 (0)