Utilities that leverage libuv's uv_timer_* API

Function delayed_send

fn delayed_send<T: copy send>(iotask: iotask, msecs: uint, ch: comm::chan<T>,
                              val: T)

Wait for timeout period then send provided value over a channel

This call returns immediately. Useful as the building block for a number of higher-level timer functions.

Is not guaranteed to wait for exactly the specified time, but will wait for at least that period of time.

Arguments

Function recv_timeout

fn recv_timeout<T: copy send>(iotask: iotask, msecs: uint,
                              wait_po: comm::port<T>) -> option<T>

Receive on a port for (up to) a specified time, then return an option<T>

This call will block to receive on the provided port for up to the specified timeout. Depending on whether the provided port receives in that time period, recv_timeout will return an option<T> representing the result.

Arguments

Returns

An option<T> representing the outcome of the call. If the call recv'd on the provided port in the allotted timeout period, then the result will be a some(T). If not, then none will be returned.

Function sleep

fn sleep(iotask: iotask, msecs: uint)

Blocks the current task for (at least) the specified time period.

Is not guaranteed to sleep for exactly the specified time, but will sleep for at least that period of time.

Arguments