Utilities that leverage libuv's uv_timer_*
API
delayed_send
- Wait for timeout period then send provided value over a channelrecv_timeout
- Receive on a port for (up to) a specified time, then return an option<T>
sleep
- Blocks the current task for (at least) the specified time period.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.
hl_loop
- a uv::hl::high_level_loop
that the tcp request will run onval
onch
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.
iotask' -
uv::iotask` that the tcp request will run oncomm::port<T>
to receive onAn 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.
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.
iotask
- a uv::iotask
that the tcp request will run on