TimeoutManager

Timeout manager

Constructors

this
this(size_t n, IAllocator allocator)

Constructor.

this
this(IAllocator allocator)

Constructor.

Members

Classes

ExpiryRegistration
class ExpiryRegistration

Expiry registration class for an object that can time out.

Functions

getRegistration
IExpiryRegistration getRegistration(ITimeoutClient client)

Creates a new expiry registration instance, associates client with it and registers client with this timeout manager. The returned object should be reused. The client will remain associated to the expiry registration after it has been unregistered from the timeout manager.

Inherited Members

From TimeoutManagerBase

TimeoutManagerInternal
class TimeoutManagerInternal

Enables IExpiryRegistration to access TimeoutManager internals.

ExpiryToClient
class ExpiryToClient

Array map mapping from an expiry registration ( a node in the tree of expiry times) to an ISelectClient.

next_expiration_us
ulong next_expiration_us()

Tells the wall clock time time when the next client will expire.

us_left
ulong us_left()

Tells the time left until the next client will expire.

pending
size_t pending()
now
ulong now()

Returns the current wall clock time according to gettimeofday().

checkTimeouts
size_t checkTimeouts(bool delegate(ITimeoutClient client) dg)

Checks for timed out clients. For any timed out client its timeout() method is called, then it is unregistered, finally dg() is called with it as argument.

checkTimeouts
size_t checkTimeouts(ulong now, bool delegate(ITimeoutClient client) dg)
Undocumented in source. Be warned that the author may not have intended to support it.
register
Expiry* register(IExpiryRegistration registration, ulong timeout_us)

Registers registration and sets the timeout for its client.

unregister
void unregister(Expiry expiry)

Unregisters the IExpiryRegistration instance corresponding to expiry.

setTimeout
void setTimeout(ulong next_expiration_us)

Called when the overall timeout needs to be set or changed.

stopTimeout
void stopTimeout()

Called when the last client has been unregistered so that the timer may be disabled.

next_expiration_us_called_from_internal
bool next_expiration_us_called_from_internal;

TODO: Remove debugging output.

printTime
void printTime(bool nl)

Prints the current wall clock time.

printTime
void printTime(ulong t, bool nl)

Prints t.

Meta