userver: engine::MultiConsumerEvent Class Reference
Loading...
Searching...
No Matches
engine::MultiConsumerEvent Class Referencefinal

#include <userver/engine/multi_consumer_event.hpp>

Detailed Description

A single-producer, multiple-consumers event.

Once the producer sends the event, it remains in the signaled state forever.

Compatible with engine::WaitAny and friends.

Destroying a MultiConsumerEvent after waking up

Unlike engine::SingleUseEvent, MultiConsumerEvent has multiple consumers, thus a consumer is not allowed to destroy MultiConsumerEvent instance, instead the producer should be responsible for that.

See also
Synchronization Primitives

Definition at line 39 of file multi_consumer_event.hpp.

+ Inheritance diagram for engine::MultiConsumerEvent:

Public Member Functions

 MultiConsumerEvent (const MultiConsumerEvent &)=delete
 
 MultiConsumerEvent (MultiConsumerEvent &&)=delete
 
MultiConsumerEventoperator= (const MultiConsumerEvent &)=delete
 
MultiConsumerEventoperator= (MultiConsumerEvent &&)=delete
 
void Wait ()
 Waits until the event is in a signaled state.
 
FutureStatus WaitUntil (Deadline)
 Waits until the event is in a signaled state, or the deadline expires, or the current task is cancelled.
 
void Send () noexcept
 
bool IsReady () const noexcept override
 Returns true if already signaled.
 

Member Function Documentation

◆ Send()

void engine::MultiConsumerEvent::Send ( )
noexcept

Sets the signal flag and wakes tasks that wait on it, if any. Send must not be called again.

You can safely invoke Send from outside a coroutine.

◆ Wait()

void engine::MultiConsumerEvent::Wait ( )

Waits until the event is in a signaled state.

Exceptions
engine::WaitInterruptedExceptionif the current task is cancelled

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