Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
Event Class Reference

A syncronization primitive that will wake up one waiting thread when signaled. More...

#include <event.h>

+ Collaboration diagram for Event:

Public Member Functions

void wait ()
 
void signal ()
 

Private Attributes

std::condition_variable cv
 
std::mutex mutex
 
bool notified = false
 

Detailed Description

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.

Member Function Documentation

◆ signal()

void Event::signal ( )

References cv, mutex, and notified.

Referenced by CurlFetchThread::processRequest(), and EmergeThread::signal().

+ Here is the caller graph for this function:

◆ wait()

void Event::wait ( )

References cv, mutex, and notified.

Referenced by httpfetch_request_clear(), and EmergeThread::run().

+ Here is the caller graph for this function:

Member Data Documentation

◆ cv

std::condition_variable Event::cv
private

Referenced by signal(), and wait().

◆ mutex

std::mutex Event::mutex
private

Referenced by signal(), and wait().

◆ notified

bool Event::notified = false
private

Referenced by signal(), and wait().


The documentation for this class was generated from the following files: