diff options
| author | Simon BD <simon@server> | 2012-10-03 21:47:09 -0500 |
|---|---|---|
| committer | Simon BD <simon@server> | 2012-10-03 21:47:09 -0500 |
| commit | efcd2385ea2389f270ff8ac8bc256636f647b130 (patch) | |
| tree | 7e142ef709bc907a34ab1cb252eef6dcc0e83b91 /src/libstd/timer.rs | |
| parent | 44f8a4401ab37a45ba49db56611d77807bcbce35 (diff) | |
| parent | 3ccf6f5932d8223fd6c5cbf7c6ac429ca9e8912a (diff) | |
| download | rust-efcd2385ea2389f270ff8ac8bc256636f647b130.tar.gz rust-efcd2385ea2389f270ff8ac8bc256636f647b130.zip | |
Merge remote-tracking branch 'original/incoming' into incoming
Conflicts: src/libstd/json.rs src/libstd/sort.rs
Diffstat (limited to 'src/libstd/timer.rs')
| -rw-r--r-- | src/libstd/timer.rs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs index 1476d6bdf31..2aca87b942e 100644 --- a/src/libstd/timer.rs +++ b/src/libstd/timer.rs @@ -1,15 +1,12 @@ //! Utilities that leverage libuv's `uv_timer_*` API -#[forbid(deprecated_mode)]; -#[forbid(deprecated_pattern)]; +// tjc: forbid deprecated modes again after snap use uv = uv; use uv::iotask; use iotask::IoTask; use comm = core::comm; -export delayed_send, sleep, recv_timeout; - /** * Wait for timeout period then send provided value over a channel * @@ -26,14 +23,14 @@ export delayed_send, sleep, recv_timeout; * * ch - a channel of type T to send a `val` on * * val - a value of type T to send over the provided `ch` */ -fn delayed_send<T: Copy Send>(iotask: IoTask, - msecs: uint, ch: comm::Chan<T>, +val: T) { +pub fn delayed_send<T: Copy Send>(iotask: IoTask, + msecs: uint, ch: comm::Chan<T>, val: T) { unsafe { let timer_done_po = core::comm::Port::<()>(); let timer_done_ch = core::comm::Chan(timer_done_po); - let timer_done_ch_ptr = ptr::addr_of(timer_done_ch); + let timer_done_ch_ptr = ptr::addr_of(&timer_done_ch); let timer = uv::ll::timer_t(); - let timer_ptr = ptr::addr_of(timer); + let timer_ptr = ptr::addr_of(&timer); do iotask::interact(iotask) |loop_ptr| unsafe { let init_result = uv::ll::timer_init(loop_ptr, timer_ptr); if (init_result == 0i32) { @@ -75,7 +72,7 @@ fn delayed_send<T: Copy Send>(iotask: IoTask, * * `iotask` - a `uv::iotask` that the tcp request will run on * * msecs - an amount of time, in milliseconds, for the current task to block */ -fn sleep(iotask: IoTask, msecs: uint) { +pub fn sleep(iotask: IoTask, msecs: uint) { let exit_po = core::comm::Port::<()>(); let exit_ch = core::comm::Chan(exit_po); delayed_send(iotask, msecs, exit_ch, ()); @@ -102,7 +99,7 @@ fn sleep(iotask: IoTask, msecs: uint) { * on the provided port in the allotted timeout period, then the result will * be a `some(T)`. If not, then `none` will be returned. */ -fn recv_timeout<T: Copy Send>(iotask: IoTask, +pub fn recv_timeout<T: Copy Send>(iotask: IoTask, msecs: uint, wait_po: comm::Port<T>) -> Option<T> { let timeout_po = comm::Port::<()>(); |
