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

#include <event.h>

Inheritance diagram for Realm::CompletionQueue:
Collaboration diagram for Realm::CompletionQueue:

Public Types

typedef ::realm_id_t id_t
 

Public Member Functions

bool operator< (const CompletionQueue &rhs) const
 
bool operator== (const CompletionQueue &rhs) const
 
bool operator!= (const CompletionQueue &rhs) const
 
bool exists (void) const
 
void destroy (Event wait_on=Event::NO_EVENT)
 
size_t pop_events (Event *events, size_t max_events)
 
Event get_nonempty_event (void)
 
void add_event (Event event)
 
void add_event_faultaware (Event event)
 

Static Public Member Functions

static CompletionQueue create_completion_queue (size_t max_size)
 

Public Attributes

id_t id
 

Static Public Attributes

static const CompletionQueue NO_QUEUE
 

Detailed Description

A completion queue funnels the completion of unordered events into a single queue that can be queried (and waited on) by a single servicer task.

Member Typedef Documentation

◆ id_t

Member Function Documentation

◆ add_event()

void Realm::CompletionQueue::add_event ( Event  event)

Add an event to the completion queue (once it triggers). non-faultaware version raises a fatal error if the specified 'event' is poisoned

Parameters
eventthe event to add

◆ add_event_faultaware()

void Realm::CompletionQueue::add_event_faultaware ( Event  event)

◆ create_completion_queue()

static CompletionQueue Realm::CompletionQueue::create_completion_queue ( size_t  max_size)
static

Create a completion queue that can hold at least 'max_size' triggered events (at the moment, overflow is a fatal error). A 'max_size' of 0 allows for arbitrary queue growth, at the cost of additional overhead.

Parameters
max_sizethe maximum size of the queue
Returns
the completion queue

◆ destroy()

void Realm::CompletionQueue::destroy ( Event  wait_on = Event::NO_EVENT)

Destroy a completion queue.

Parameters
wait_onan event to wait on before destroying the queue.

◆ exists()

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

◆ get_nonempty_event()

Event Realm::CompletionQueue::get_nonempty_event ( void  )

Get an event that, once triggered, guarantees that (at least) one call to pop_events made since the non-empty event was requested will return a non-zero number of triggered events. Once a call to pop_events has been made (by the caller of get_nonempty_event or anybody else), the guarantee is lost and a new non-empty event must be requested. Note that 'get_nonempty_event().has_triggered()' is unlikely to ever return 'true' if called from a node other than the one that created the completion queue (i.e. the query at least has the round-trip network communication latency to deal with) - if polling on the completion queue is unavoidable, the loop should poll on pop_events directly.

Returns
the non-empty event

◆ operator!=()

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

◆ operator<()

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

◆ operator==()

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

◆ pop_events()

size_t Realm::CompletionQueue::pop_events ( Event events,
size_t  max_events 
)

Requests up to 'max_events' triggered events to be popped from the queue and stored in the provided 'events' array (if null, the identities of the triggered events are discarded). This call returns the actual number of events popped, which may be zero (this call is nonblocking). When 'add_event_faultaware' is used, any poisoning of the returned events is not signalled explicitly - the caller is expected to check via 'has_triggered_faultaware' itself.

Parameters
eventsthe array to store the events in
max_eventsthe maximum number of events to pop
Returns
the number of events popped

Member Data Documentation

◆ id

id_t Realm::CompletionQueue::id

◆ NO_QUEUE

const CompletionQueue Realm::CompletionQueue::NO_QUEUE
static

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