Realm
A distributed, event-based tasking library
Loading...
Searching...
No Matches
Realm::Event Class Reference

#include <event.h>

Inheritance diagram for Realm::Event:
Collaboration diagram for Realm::Event:

Public Types

typedef ::realm_id_t id_t
 

Public Member Functions

 Event ()=default
 
constexpr Event (id_t id)
 
constexpr operator id_t () const
 
bool operator< (const Event &rhs) const
 
bool operator== (const Event &rhs) const
 
bool operator!= (const Event &rhs) const
 
bool exists (void) const
 
bool has_triggered (void) const
 
void wait (void) const
 
void external_wait (void) const
 
bool external_timedwait (long long max_ns) const
 
bool has_triggered_faultaware (bool &poisoned) const
 
void wait_faultaware (bool &poisoned) const
 
void external_wait_faultaware (bool &poisoned) const
 
bool external_timedwait_faultaware (bool &poisoned, long long max_ns) const
 
void subscribe (void) const
 
void cancel_operation (const void *reason_data, size_t reason_size) const
 
void set_operation_priority (int new_priority) const
 

Static Public Member Functions

static Event merge_events_ignorefaults (const Event *wait_for, size_t num_events)
 
static Event merge_events_ignorefaults (const span< const Event > &wait_for)
 
static Event merge_events_ignorefaults (const std::set< Event > &wait_for)
 
static Event ignorefaults (Event wait_for)
 
static void advise_event_ordering (Event happens_before, Event happens_after)
 
static void advise_event_ordering (const Event *happens_before, size_t num_events, Event happens_after, bool all_must_trigger=true)
 
static void advise_event_ordering (const span< Event > &happens_before, Event happens_after, bool all_must_trigger=true)
 
static Event merge_events (const Event *wait_for, size_t num_events)
 
static Event merge_events (Event ev1, Event ev2, Event ev3=NO_EVENT, Event ev4=NO_EVENT, Event ev5=NO_EVENT, Event ev6=NO_EVENT)
 
static Event merge_events (const std::set< Event > &wait_for)
 
static Event merge_events (const span< const Event > &wait_for)
 

Public Attributes

id_t id {REALM_NO_EVENT}
 

Static Public Attributes

static const Event NO_EVENT
 The value should be usued to initialize an event handle. NO_EVENT is always in has triggered state .
 

Detailed Description

Event is created by the runtime and is used to synchronize operations. An event is triggered when the operation it represents is complete and can be used as pre and post conditions for other operations. This class represents a handle to the event itself and can be passed-by-value as well as serialized/deserialized anywhere in the program. Note that events do not need to be explicitly garbage collected.

Member Typedef Documentation

◆ id_t

Constructor & Destructor Documentation

◆ Event() [1/2]

Realm::Event::Event ( )
default

◆ Event() [2/2]

constexpr Realm::Event::Event ( id_t  id)
inlineexplicitconstexpr

Member Function Documentation

◆ advise_event_ordering() [1/3]

static void Realm::Event::advise_event_ordering ( const Event happens_before,
size_t  num_events,
Event  happens_after,
bool  all_must_trigger = true 
)
static

◆ advise_event_ordering() [2/3]

static void Realm::Event::advise_event_ordering ( const span< Event > &  happens_before,
Event  happens_after,
bool  all_must_trigger = true 
)
static

◆ advise_event_ordering() [3/3]

static void Realm::Event::advise_event_ordering ( Event  happens_before,
Event  happens_after 
)
static

The following call is used to give Realm a bound on when the UserEvent will be triggered. In addition to being useful for diagnostic purposes (e.g. detecting event cycles), having a "happens_before" allows Realm to judge that the UserEvent trigger is "in flight".

Parameters
happens_beforethe event that must occur before the UserEvent
happens_afterthe event that must occur after the UserEvent

◆ cancel_operation()

void Realm::Event::cancel_operation ( const void *  reason_data,
size_t  reason_size 
) const

Attempt to cancel the operation associated with this event.

Parameters
reason_datawill be provided to any profilers of the operation
reason_sizethe size of the reason data

◆ exists()

bool Realm::Event::exists ( void  ) const

Check whether an event has a valid ID.

Returns
true if the event has a valid ID, false otherwise

◆ external_timedwait()

bool Realm::Event::external_timedwait ( long long  max_ns) const

External wait with a timeout - returns true if event triggers, false if the maximum delay occurs first

Parameters
max_nsthe maximum number of nanoseconds to wait
Returns
true if the event has triggered, false if the timeout occurred

◆ external_timedwait_faultaware()

bool Realm::Event::external_timedwait_faultaware ( bool &  poisoned,
long long  max_ns 
) const

Fault-aware versions of the external timed wait function.

Parameters
poisonedset to true if the event is poisoned
max_nsthe maximum number of nanoseconds to wait
Returns
true if the event has triggered, false if the timeout occurred

◆ external_wait()

void Realm::Event::external_wait ( void  ) const

Used by non-legion threads to wait on an event - always blocking

◆ external_wait_faultaware()

void Realm::Event::external_wait_faultaware ( bool &  poisoned) const

Fault-aware versions of the external wait function.

Parameters
poisonedset to true if the event is poisoned
Returns
true if the event has triggered, false otherwise

◆ has_triggered()

bool Realm::Event::has_triggered ( void  ) const

Test whether an event has triggered without waiting.

Returns
true if the event has triggered, false otherwise

◆ has_triggered_faultaware()

bool Realm::Event::has_triggered_faultaware ( bool &  poisoned) const

Fault-aware versions of the above (the above versions will cause the caller to fault as well if a poisoned event is queried).

Parameters
poisonedset to true if the event is poisoned
Returns
true if the event has triggered, false otherwise

◆ ignorefaults()

static Event Realm::Event::ignorefaults ( Event  wait_for)
static

◆ merge_events() [1/4]

static Event Realm::Event::merge_events ( const Event wait_for,
size_t  num_events 
)
static

Create an event that won't trigger until all input events have.

Parameters
wait_forthe events to wait for
Returns
the event that will trigger when all input events have.

◆ merge_events() [2/4]

static Event Realm::Event::merge_events ( const span< const Event > &  wait_for)
static

◆ merge_events() [3/4]

static Event Realm::Event::merge_events ( const std::set< Event > &  wait_for)
static

◆ merge_events() [4/4]

static Event Realm::Event::merge_events ( Event  ev1,
Event  ev2,
Event  ev3 = NO_EVENT,
Event  ev4 = NO_EVENT,
Event  ev5 = NO_EVENT,
Event  ev6 = NO_EVENT 
)
static

◆ merge_events_ignorefaults() [1/3]

static Event Realm::Event::merge_events_ignorefaults ( const Event wait_for,
size_t  num_events 
)
static

Create an event that won't trigger until all input events have, ignoring any poison on the input events.

Parameters
wait_forthe events to wait for
Returns
the event that will trigger when all input events have.

◆ merge_events_ignorefaults() [2/3]

static Event Realm::Event::merge_events_ignorefaults ( const span< const Event > &  wait_for)
static

◆ merge_events_ignorefaults() [3/3]

static Event Realm::Event::merge_events_ignorefaults ( const std::set< Event > &  wait_for)
static

◆ operator id_t()

constexpr Realm::Event::operator id_t ( ) const
inlineconstexpr

◆ operator!=()

bool Realm::Event::operator!= ( const Event rhs) const

◆ operator<()

bool Realm::Event::operator< ( const Event rhs) const

◆ operator==()

bool Realm::Event::operator== ( const Event rhs) const

◆ set_operation_priority()

void Realm::Event::set_operation_priority ( int  new_priority) const

Attempt to change the priority of the operation associated with this event.

Parameters
new_prioritythe new priority.

◆ subscribe()

void Realm::Event::subscribe ( void  ) const

Subscribe to an event, ensuring that the triggeredness of the event will be available as soon as possible (and without having to call wait).

◆ wait()

void Realm::Event::wait ( void  ) const

Wait for an event to trigger.

◆ wait_faultaware()

void Realm::Event::wait_faultaware ( bool &  poisoned) const

Fault-aware versions of the wait function.

Parameters
poisonedset to true if the event is poisoned
Returns
true if the event has triggered, false otherwise

Member Data Documentation

◆ id

id_t Realm::Event::id {REALM_NO_EVENT}

◆ NO_EVENT

const Event Realm::Event::NO_EVENT
static

The value should be usued to initialize an event handle. NO_EVENT is always in has triggered state .


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