class Event

Defined at line 39 of file ../../zircon/kernel/include/kernel/event.h

Rules for Events and AutounsignalEvents:

- Events may be signaled from interrupt context *but* preemption must be

disabled.

- Events may not be waited upon from interrupt context.

- Standard Events:

- Wake up any waiting threads when signaled.

- Continue to do so (no threads will wait) until unsignaled.

- Stores a single result value when first signaled. This result is

returned to waiters and cleared when unsignaled.

- AutounsignalEvents:

- If one or more threads are waiting when signaled, one thread will

be woken up and return. The signaled state will not be set.

- If no threads are waiting when signaled, the AutounsignalEvent will remain

in the signaled state until a thread attempts to wait (at which

time it will unsignal atomicly and return immediately) or

AutounsignalEvent::Unsignal() is called.

- Stores a single result value when signaled until a thread is woken.

Public Methods

zx_status_t Wait (zx::duration timeout)

Defined at line 9 of file ../../src/zircon/testing/mutex_pi_exerciser/event.cc

void Event ()

Defined at line 15 of file ../../src/zircon/testing/mutex_pi_exerciser/event.h

void Event (Event && )

Defined at line 16 of file ../../src/zircon/testing/mutex_pi_exerciser/event.h

Event & operator= (Event && )

Defined at line 16 of file ../../src/zircon/testing/mutex_pi_exerciser/event.h

void Signal ()

Defined at line 23 of file ../../src/zircon/testing/mutex_pi_exerciser/event.cc

void Reset ()

Defined at line 31 of file ../../src/zircon/testing/mutex_pi_exerciser/event.cc

void Event (bool initial)

Defined at line 41 of file ../../zircon/kernel/include/kernel/event.h

void Event (const Event & )

Defined at line 45 of file ../../zircon/kernel/include/kernel/event.h

Event & operator= (const Event & )

Defined at line 46 of file ../../zircon/kernel/include/kernel/event.h

void ~Event ()

Destruct an Event object.

Event's resources are freed and it may no longer be used.

Will panic if there are any threads still waiting.

Defined at line 50 of file ../../zircon/kernel/kernel/event.cc

zx_status_t Wait (const Deadline & deadline)

Returns:

ZX_OK - signaled

ZX_ERR_TIMED_OUT - time out expired

ZX_ERR_INTERNAL_INTR_KILLED - thread killed

ZX_ERR_INTERNAL_INTR_RETRY - thread is suspended

Or the |status| which the caller specified in Event::Signal(status)

Defined at line 58 of file ../../zircon/kernel/include/kernel/event.h

zx_status_t Wait (const Deadline & deadline, uint signal_mask)

Same as Wait() but gives a mask of signals to ignore. The signal_mask only applies to existing

signals, not future ones that might be signaled while waiting.

The caller must be interruptible.

Defined at line 63 of file ../../zircon/kernel/include/kernel/event.h

zx_status_t Wait ()

No deadline, non interruptible version of Wait().

Defined at line 68 of file ../../zircon/kernel/include/kernel/event.h

zx_status_t WaitDeadline (zx_instant_mono_t deadline, Interruptible interruptible)

Wait until a zx_instant_mono_t deadline.

Interruptible arg allows it to return early with ZX_ERR_INTERNAL_INTR_KILLED if thread

is signaled for kill or with ZX_ERR_INTERNAL_INTR_RETRY if the thread is suspended.

Defined at line 73 of file ../../zircon/kernel/include/kernel/event.h

bool is_signaled ()

Defined at line 88 of file ../../zircon/kernel/include/kernel/event.h

void Signal (zx_status_t wait_result, OwnedWaitQueue * queue_to_own)

Signal an event

Signals an event. If Event::AUTOUNSIGNAL is set in the event

object's flags, only one waiting thread is allowed to proceed. Otherwise,

all waiting threads are allowed to proceed until such time as

Event::Unsignal() is called.

Parameters

e Event object
wait_result What status a wait call will return to the thread or threads that are woken up.

Defined at line 121 of file ../../zircon/kernel/kernel/event.cc

zx_status_t Unsignal ()

Clear the "signaled" property of an event

Used mainly for event objects without the Event::AUTOUNSIGNAL

flag. Once this function is called, threads that call Event::Wait()

functions will once again need to wait until the event object

is signaled.

Parameters

e Event object

Returns

Returns ZX_OK on success.

Defined at line 244 of file ../../zircon/kernel/kernel/event.cc

Protected Methods

void Event (bool initial, Flags flags)

Only our AutounsignalEvent subclass can also access this, to keep the flags private.

Defined at line 97 of file ../../zircon/kernel/include/kernel/event.h

Enumerations

enum Flags
Name Value
NONE 0
AUTOUNSIGNAL 1

Defined at line 91 of file ../../zircon/kernel/include/kernel/event.h