diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-11-06 11:38:53 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-11-10 01:37:11 -0800 |
| commit | b545751597a8cdeee4554338318f0ed6339634fd (patch) | |
| tree | e59d2c56af2c4547641b9b83b4b7939ee3a25f0d /src/libstd/rt/rtio.rs | |
| parent | d08aadcc9aff233165a063df73c6436e0969f79c (diff) | |
Rework the idle callback to have a safer interface
It turns out that the uv implementation would cause use-after-free if the idle callback was used after the call to `close`, and additionally nothing would ever really work that well if `start()` were called twice. To change this, the `start` and `close` methods were removed in favor of specifying the callback at creation, and allowing destruction to take care of closing the watcher.
Diffstat (limited to 'src/libstd/rt/rtio.rs')
| -rw-r--r-- | src/libstd/rt/rtio.rs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/libstd/rt/rtio.rs b/src/libstd/rt/rtio.rs index 96ba5123456..1e12da8645c 100644 --- a/src/libstd/rt/rtio.rs +++ b/src/libstd/rt/rtio.rs @@ -31,7 +31,7 @@ pub trait Callback { pub trait EventLoop { fn run(&mut self); fn callback(&mut self, proc()); - fn pausible_idle_callback(&mut self) -> ~PausibleIdleCallback; + fn pausible_idle_callback(&mut self, ~Callback) -> ~PausibleIdleCallback; fn remote_callback(&mut self, ~Callback) -> ~RemoteCallback; /// The asynchronous I/O services. Not all event loops may provide one @@ -226,10 +226,8 @@ pub trait RtioTTY { } pub trait PausibleIdleCallback { - fn start(&mut self, f: ~Callback); fn pause(&mut self); fn resume(&mut self); - fn close(&mut self); } pub trait RtioSignal {} |
