Class CompNode::Event

Nested Relationships

This class is a nested type of Class CompNode.

Inheritance Relationships

Base Type

  • public NonCopyableObj

Class Documentation

class mgb::CompNode::Event : public NonCopyableObj

event associated with a CompNode node, used for cross-device synchronization

Public Types

enum Flags


enumerator NEED_TIMER = 1

Public Functions

~Event() = default
void record() = 0

record this event on the comp node that creates it

Note that if a comp node is recorded multiple times, then subsequent calls would overwrite its internal state and other methods that examine the status would only examine the completion of the most recent call to record().

bool finished() = 0

whether this event has finished; it must has been recorded

void host_wait() = 0

block the host thread (caller thread) to wait for this event

double elapsed_time_until(Event &end) = 0

get elapsed time in seconds from this to another event; the events must be finished

void device_wait_by(CompNode cn) = 0

record an action on another comp node so it would wait for this event

CompNode comp_node() const = 0

get the comp node to which this event is associated

size_t create_flags() const

flags when this event is created

Public Static Functions

void set_cpu_sync_level(int level)

set CPU resource usage level when performing synchronization

  • level: CPU waiting level: 0. condition var (the default)

    1. busy wait with yield

    2. busy wait

Protected Functions

Event(size_t create_flags)

Protected Attributes

size_t const m_create_flags

flags when this event is created

Protected Static Attributes

int sm_cpu_sync_level