Skip to content

Commit

Permalink
optimise
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Sep 11, 2024
1 parent 7c4d194 commit 575a1e1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Watcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,23 @@ void Watcher::notify() {
}
}

void Watcher::notify() {
{
std::unique_lock<std::mutex> lk(mMutex);
mCond.notify_all();

if (mCallbacks.size() == 0 || mEvents.size() == 0) {
return;
}
}

// We must have released 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.
mDebounce->trigger();
}

struct CallbackData {
std::string error;
std::vector<Event> events;
Expand Down

0 comments on commit 575a1e1

Please sign in to comment.