A syncronization primitive that will wake up one waiting thread when signaled. More...
#include <event.h>
Public Member Functions | |
void | wait () |
void | signal () |
Private Attributes | |
std::condition_variable | cv |
std::mutex | mutex |
bool | notified = false |
A syncronization primitive that will wake up one waiting thread when signaled.
Calling signal()
multiple times before a waiting thread has had a chance to notice the signal will wake only one thread. Additionally, if no threads are waiting on the event when it is signaled, the next call to wait()
will return (almost) immediately.
void Event::signal | ( | ) |
References cv, mutex, and notified.
Referenced by CurlFetchThread::processRequest(), and EmergeThread::signal().
void Event::wait | ( | ) |
References cv, mutex, and notified.
Referenced by httpfetch_request_clear(), and EmergeThread::run().