EventDriver

Interface for all evented I/O implementations.

This is the low level interface for all event based functionality. It is not intended to be used directly by users of the library.

Members

Functions

acquireTimer
void acquireTimer(size_t timer_id)

Increases the reference count by one.

connectTCP
TCPConnection connectTCP(NetworkAddress address, NetworkAddress bind_address)

Establiches a tcp connection on the specified host/port.

createFileDescriptorEvent
FileDescriptorEvent createFileDescriptorEvent(int file_descriptor, FileDescriptorEvent.Trigger triggers, FileDescriptorEvent.Mode mode)

Creates an event for waiting on a non-bocking file handle.

createManualEvent
ManualEvent createManualEvent()

Creates a new manually triggered event.

createTimer
size_t createTimer(void delegate() @(safe) callback)

Creates a new timer.

dispose
void dispose()

Frees all resources of the driver and prepares it for consumption by the GC.

exitEventLoop
void exitEventLoop()

Exits any running event loop.

isTimerPending
bool isTimerPending(size_t timer_id)

Queries if the timer is currently active.

listenTCP
TCPListener listenTCP(ushort port, void delegate(TCPConnection conn) @(safe) conn_callback, string bind_address, TCPListenOptions options)

Listens on the specified port and interface for TCP connections.

listenUDP
UDPConnection listenUDP(ushort port, string bind_address)

Creates a new UDP socket and sets the specified address/port as the destination for packets.

openFile
FileStream openFile(Path path, FileMode mode)

Opens a file on disk with the speficied file mode.

processEvents
bool processEvents()

Processes all outstanding events if any, does not block.

rearmTimer
void rearmTimer(size_t timer_id, Duration dur, bool periodic)

Resets the timeout of the timer.

releaseTimer
void releaseTimer(size_t timer_id)

Decreases the reference count by one.

resolveHost
NetworkAddress resolveHost(string host, ushort family, bool use_dns)

Resolves the given host name or IP address string.

runEventLoop
int runEventLoop()

Starts the event loop.

runEventLoopOnce
int runEventLoopOnce()
Undocumented in source.
stopTimer
void stopTimer(size_t timer_id)

Stops the timer.

waitTimer
void waitTimer(size_t timer_id)

Waits for the pending timer to expire.

watchDirectory
DirectoryWatcher watchDirectory(Path path, bool recursive)

Starts watching a directory for changes.

Meta