class Poco::Event

Overview

An Event is a synchronization object that allows one thread to signal one or more other threads that a certain event has happened. Moreā€¦

#include <Event.h>

class Event: private Poco::EventImpl
{
public:
    // construction

    Event(bool autoReset = true);

    // methods

    void
    set();

    void
    wait();

    void
    wait(long milliseconds);

    bool
    tryWait(long milliseconds);

    void
    reset();
};

Inherited Members

protected:
    // methods

    void
    setImpl();

    void
    waitImpl();

    bool
    waitImpl(long milliseconds);

    void
    resetImpl();

Detailed Documentation

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.

Construction

Event(bool autoReset = true)

Creates the event.

If autoReset is true, the event is automatically reset after a wait() successfully returns.

Methods

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.

void
wait()

Waits for the event to become signalled.

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.

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.

void
reset()

Resets the event to unsignalled state.