TimeoutManagerBase

Timeout manager base class. Required for derivation because inside a TimeoutManager subclass a nested ExpiryRegistration subclass is impossible.

Constructors

this
this(size_t n, IAllocator allocator)

Constructor.

Members

Classes

ExpiryToClient
class ExpiryToClient

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

TimeoutManagerInternal
class TimeoutManagerInternal

Enables IExpiryRegistration to access TimeoutManager internals.

Functions

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.
next_expiration_us
ulong next_expiration_us()

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

now
ulong now()

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

pending
size_t pending()
printTime
void printTime(bool nl)

Prints the current wall clock time.

register
Expiry* register(IExpiryRegistration registration, ulong timeout_us)

Registers registration and sets the timeout for its client.

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.

unregister
void unregister(Expiry expiry)

Unregisters the IExpiryRegistration instance corresponding to expiry.

us_left
ulong us_left()

Tells the time left until the next client will expire.

Static functions

printTime
void printTime(ulong t, bool nl)

Prints t.

Variables

next_expiration_us_called_from_internal
bool next_expiration_us_called_from_internal;

TODO: Remove debugging output.

Inherited Members

From ITimeoutManager

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 until the next client will expire.

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.

getRegistration
IExpiryRegistration getRegistration(ITimeoutClient client)

Registers client with the timeout manager and returns the expiry registration object which the registered client is associated to.

Meta