diff options
| author | toddaaro <github@opprobrio.us> | 2013-08-15 11:13:41 -0700 |
|---|---|---|
| committer | toddaaro <github@opprobrio.us> | 2013-08-16 16:37:09 -0700 |
| commit | 066ca17eaae239a666579fc80fe9047aaac0599d (patch) | |
| tree | 1f8fac52d7e580e9bc2eafcb5366d31146aa43f1 /src/libstd/rt/uv | |
| parent | 680eb71564ebba5e76ce1e1a8287b30042332cc5 (diff) | |
| download | rust-066ca17eaae239a666579fc80fe9047aaac0599d.tar.gz rust-066ca17eaae239a666579fc80fe9047aaac0599d.zip | |
an attempt at a singleton pausible idle callback for each scheduler. suffers from nondeterministic deadlock and also pending scheduler messages on scheduler shutdown.
Diffstat (limited to 'src/libstd/rt/uv')
| -rw-r--r-- | src/libstd/rt/uv/idle.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstd/rt/uv/idle.rs b/src/libstd/rt/uv/idle.rs index b73be9f7250..a21146620ca 100644 --- a/src/libstd/rt/uv/idle.rs +++ b/src/libstd/rt/uv/idle.rs @@ -48,6 +48,20 @@ impl IdleWatcher { } } + pub fn restart(&mut self) { + unsafe { + assert!(0 == uvll::idle_start(self.native_handle(), idle_cb)) + }; + + extern fn idle_cb(handle: *uvll::uv_idle_t, status: c_int) { + let mut idle_watcher: IdleWatcher = NativeHandle::from_native_handle(handle); + let data = idle_watcher.get_watcher_data(); + let cb: &IdleCallback = data.idle_cb.get_ref(); + let status = status_to_maybe_uv_error(idle_watcher, status); + (*cb)(idle_watcher, status); + } + } + pub fn stop(&mut self) { // NB: Not resetting the Rust idle_cb to None here because `stop` is // likely called from *within* the idle callback, causing a use after |
