Poco

class Event

Library: Foundation
Package: Threading
Header: Poco/Event.h

Description

An Event is a synchronization object that allows one thread to signal one or more other threads that a certain event has happened. Usually, one thread signals an event, while one or more other threads wait for an event to become signalled.

Inheritance

Direct Base Classes: EventImpl

All Base Classes: EventImpl

Member Summary

Member Functions: reset, set, tryWait, wait

Enumerations

EventType

EVENT_MANUALRESET

Manual reset event

EVENT_AUTORESET

Auto-reset event

Constructors

Event

explicit Event(
    EventType type = EVENT_AUTORESET
);

Creates the event. If type is EVENT_AUTORESET, the event is automatically reset after a wait() successfully returns.

Event

explicit Event(
    bool autoReset
);

Please use Event::Event(EventType) instead.

Destructor

~Event

~Event();

Destroys the event.

Member Functions

reset inline

void reset();

Resets the event to unsignalled state.

set inline

void set();

Signals the event. If autoReset is true, only one thread waiting for the event can resume execution. If autoReset is false, all waiting threads can resume execution.

tryWait inline

bool tryWait(
    long milliseconds
);

Waits for the event to become signalled. Returns true if the event became signalled within the specified time interval, false otherwise.

wait inline

void wait();

Waits for the event to become signalled.

wait

void wait(
    long milliseconds
);

Waits for the event to become signalled. Throws a TimeoutException if the event does not become signalled within the specified time interval.