EventDriverEvents

Cross-thread notifications

"Events" can be used to wake up the event loop of a foreign thread. This is the basis for all kinds of thread synchronization primitives, such as mutexes, condition variables, message queues etc. Such primitives, in case of extended wait periods, should use events rather than traditional means to block, such as busy loops or kernel based wait mechanisms to avoid stalling the event loop.

Members

Functions

addRef
void addRef(EventID descriptor)

Increments the reference count of the given event.

cancelWait
void cancelWait(EventID event, EventCallback on_event)

Cancels an ongoing wait operation.

create
EventID create()

Creates a new cross-thread event.

isValid
bool isValid(EventID handle)

Determines whether the given event handle is valid.

rawUserData
void* rawUserData(EventID descriptor, size_t size, DataInitializer initialize, DataInitializer destroy)

Low-level user data access. Use userData instead.

releaseRef
bool releaseRef(EventID descriptor)

Decrements the reference count of the given event.

trigger
void trigger(EventID event, bool notify_all)

Triggers an event owned by the current thread.

trigger
void trigger(EventID event, bool notify_all)

Triggers an event possibly owned by a different thread.

wait
void wait(EventID event, EventCallback on_event)

Waits until an event gets triggered.

Properties

userData
EventID userData [@property setter]

Retrieves a reference to a user-defined value associated with a descriptor.

Meta