From 7a1d97e62cd467596457d850fd5e73f6160159c2 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 25 Oct 2013 21:55:10 -0700 Subject: Enhance timers to create ports In addition to being able to sleep the current task, timers should be able to create ports which get notified after a period of time. Closes #10014 --- src/libstd/rt/rtio.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/libstd/rt/rtio.rs') diff --git a/src/libstd/rt/rtio.rs b/src/libstd/rt/rtio.rs index 29f728a5e0c..366388063d4 100644 --- a/src/libstd/rt/rtio.rs +++ b/src/libstd/rt/rtio.rs @@ -11,7 +11,7 @@ use libc; use option::*; use result::*; -use comm::SharedChan; +use comm::{SharedChan, PortOne, Port}; use libc::c_int; use c_str::CString; @@ -162,6 +162,8 @@ pub trait RtioUdpSocket : RtioSocket { pub trait RtioTimer { fn sleep(&mut self, msecs: u64); + fn oneshot(&mut self, msecs: u64) -> PortOne<()>; + fn period(&mut self, msecs: u64) -> Port<()>; } pub trait RtioFileStream { -- cgit 1.4.1-3-g733a5