We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b78d0c2 + efeaeb8 commit 927d378Copy full SHA for 927d378
src/task_wait_event.h
@@ -56,7 +56,7 @@ class task_wait_event {
56
// Check if a specific event is ready
57
bool try_wait(int event)
58
{
59
- std::unique_lock<std::mutex> lock(m);
+ std::lock_guard<std::mutex> lock(m);
60
int result = event_mask & event;
61
event_mask &= ~event;
62
return result != 0;
@@ -65,8 +65,9 @@ class task_wait_event {
65
// Signal an event and wake up a sleeping thread
66
void signal(int event)
67
68
- std::lock_guard<std::mutex> lock(m);
+ std::unique_lock<std::mutex> lock(m);
69
event_mask |= event;
70
+ lock.unlock();
71
c.notify_one();
72
}
73
};
0 commit comments