EventLoop

Interface of event loop.

abstract
class EventLoop {
State state;
}

Members

Functions

callAt
auto callAt(SysTime when, Dg dg, Args args)

Arrange for the callback to be called at the given absolute timestamp when (an int or float), using the same time reference as time().

callExceptionHandler
void callExceptionHandler(ExceptionContext exceptionContext)

Call the current event loop's exception handler.

callLater
auto callLater(Duration delay, Dg dg, Args args)

Arrange for the callback to be called after the given delay.

callSoon
auto callSoon(Dg dg, Args args)

Arrange for a callback to be called as soon as possible.

callSoonThreadSafe
auto callSoonThreadSafe(Dg dg, Args args)

Like $(D_PSYMBOL callSoon()), but thread safe.

close
void close()

Close the event loop. The loop must not be running.

createConnection
auto createConnection(ProtocolFactory protocolFactory, in char[] host = null, in char[] service = null, SslContext sslContext = null, AddressFamily addressFamily = UNSPECIFIED!AddressFamily, ProtocolType protocolType = UNSPECIFIED!ProtocolType, AddressInfoFlags addressInfoFlags = UNSPECIFIED!AddressInfoFlags, Socket socket = null, in char[] localHost = null, in char[] localService = null, in char[] serverHostname = null)

Create a streaming transport connection to a given Internet host and port: socket family $(D_PSYMBOL AddressFamily.INET) or $(D_PSYMBOL AddressFamily.INET6) depending on host (or family if specified), socket type $(D_PSYMBOL SocketType.STREAM).

createDatagramEndpoint
auto createDatagramEndpoint(DatagramProtocolFactory datagramProtocolFactory, in char[] localHost = null, in char[] localService = null, in char[] remoteHost = null, in char[] remoteService = null, AddressFamily addressFamily = UNSPECIFIED!AddressFamily, ProtocolType protocolType = UNSPECIFIED!ProtocolType, AddressInfoFlags addressInfoFlags = UNSPECIFIED!AddressInfoFlags)

Create datagram connection: socket family $(D_PSYMBOL AddressFamily.INET) or $(D_PSYMBOL AddressFamily.INET6) depending on host (or family if specified), socket type $(D_PSYMBOL SocketType.DGRAM).

createServer
Server createServer(ProtocolFactory protocolFactory, in char[] host = null, in char[] service = null, AddressFamily addressFamily = UNSPECIFIED!AddressFamily, AddressInfoFlags addressInfoFlags = AddressInfoFlags.PASSIVE, Socket socket = null, int backlog = 100, SslContext sslContext = null, bool reuseAddress = true)

A coroutine which creates a TCP server bound to host and port.

createTask
auto createTask(Coroutine coroutine, Args args)

Schedule the execution of a fiber object: wrap it in a future.

createUnixConnection
auto createUnixConnection(ProtocolFactory protocolFactory, in char[] path = null, SslContext sslContext = null, Socket socket = null, in char[] serverHostname = null)

Create UNIX connection: socket family $(D_PSYMBOL AddressFamily.UNIX), socket type $(D_PSYMBOL SocketType.STREAM). The UNIX socket family is used to communicate between processes on the same machine efficiently.

createUnixServer
Server createUnixServer(ProtocolFactory protocolFactory, in char[] path, Socket socket = null, int backlog = 100, SslContext sslContext = null)

Similar to $(D_PSYMBOL EventLoop.createServer()), but specific to the socket family $(D_PSYMBOL AddressFamily.UNIX).

defaultExceptionHandler
void defaultExceptionHandler(ExceptionContext exceptionContext)

Default exception handler.

isClosed
bool isClosed()
isRunning
bool isRunning()
runForever
void runForever()

Run until $(D_PSYMBOL stop()) is called.

runUntilComplete
T runUntilComplete(Future!T future)

Run until $(PARAM future) is done.

setExceptionHandler
void setExceptionHandler(ExceptionHandler exceptionHandler)

Set handler as the new event loop exception handler.

stop
void stop()

Stop running the event loop.

time
SysTime time()

Return the current time according to the event loop’s internal clock.

Meta