ocean.io.select.client.SelectEvent

Custom event which can be registered with the EpollSelectDispatcher.

An instance of this class can be registered with an EpollSelectDispatcher, and triggered at will, causing it to be selected in the select loop. When it is selected, a user-specified callback (given in the class' constructor) is invoked.

Two versions of the class exist, one which counts the number of calls to trigger() before the callback is invoked (and passes the count to the callback), and one which does not keep a count.

Usage example:

import ocean.io.select.client.SelectEvent;
import ocean.io.select.EpollSelectDispatcher;

// Event handler
void handler ( )
{
    // Do something
}

auto dispatcher = new EpollSelectDispatcher;
auto event = new SelectEvent(&handler);

dispatcher.register(event);

dispatcher.eventLoop();

// At this point, any time event.trigger is called, the eventLoop will
// select the event and invoke its handler callback.

Members

Classes

CountingSelectEvent
class CountingSelectEvent

CountingSelectEvent class -- calls the user-provided callback (passed to the constructor) when the event is fired from epoll. The trigger() method causes the event to fire. The number of calls to trigger() which occurred before the event fires is counted and passed to the callback.

ISelectEvent
class ISelectEvent

CountingSelectEvent class -- counts and reports the number of times the trigger() method was called preivous to the event being fired in epoll and the class' handle() method being invoked.

SelectEvent
class SelectEvent

SelectEvent class -- calls the user-provided callback (passed to the constructor) when the event is fired from epoll. The trigger() method causes the event to fire.

Meta

License

Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. Alternatively, this file may be distributed under the terms of the Tango 3-Clause BSD License (see LICENSE_BSD.txt for details).