diff --git a/src/Watcher.cc b/src/Watcher.cc index abb7ae6..4c7e24e 100644 --- a/src/Watcher.cc +++ b/src/Watcher.cc @@ -66,6 +66,11 @@ void Watcher::notify() { mCond.notify_all(); if (mCallbacks.size() > 0 && mEvents.size() > 0) { + // We must release our lock before calling into the debouncer + // to avoid a deadlock: the debouncer thread itself will require + // our lock from its thread when calling into `triggerCallbacks` + // while holding its own debouncer lock. + lk.unlock(); mDebounce->trigger(); } }