Skip to content

Commit 3ee5ef1

Browse files
committed
Remove the 'callback_ms' function from EventLoop
This is a peculiar function to require event loops to implement, and it's only used in one spot during tests right now. Instead, a possibly more robust apis for timers should be used rather than requiring all event loops to implement a curious-looking function.
1 parent 3b30377 commit 3ee5ef1

File tree

3 files changed

+3
-20
lines changed

3 files changed

+3
-20
lines changed

src/libstd/rt/rtio.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ pub trait EventLoop {
2828
fn run(&mut self);
2929
fn callback(&mut self, ~fn());
3030
fn pausible_idle_callback(&mut self) -> ~PausibleIdleCallback;
31-
fn callback_ms(&mut self, ms: u64, ~fn());
3231
fn remote_callback(&mut self, ~fn()) -> ~RemoteCallback;
3332

3433
/// The asynchronous I/O services. Not all event loops may provide one

src/libstd/rt/sched.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,22 +1147,15 @@ mod test {
11471147

11481148
#[test]
11491149
fn test_io_callback() {
1150+
use rt::io::timer;
1151+
11501152
// This is a regression test that when there are no schedulable tasks
11511153
// in the work queue, but we are performing I/O, that once we do put
11521154
// something in the work queue again the scheduler picks it up and doesn't
11531155
// exit before emptying the work queue
11541156
do run_in_newsched_task {
11551157
do spawntask {
1156-
let sched: ~Scheduler = Local::take();
1157-
do sched.deschedule_running_task_and_then |sched, task| {
1158-
let task = Cell::new(task);
1159-
do sched.event_loop.callback_ms(10) {
1160-
rtdebug!("in callback");
1161-
let mut sched: ~Scheduler = Local::take();
1162-
sched.enqueue_blocked_task(task.take());
1163-
Local::put(sched);
1164-
}
1165-
}
1158+
timer::sleep(10);
11661159
}
11671160
}
11681161
}

src/libstd/rt/uv/uvio.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,6 @@ impl EventLoop for UvEventLoop {
222222
} as ~PausibleIdleCallback
223223
}
224224

225-
fn callback_ms(&mut self, ms: u64, f: ~fn()) {
226-
let mut timer = TimerWatcher::new(self.uvio.uv_loop());
227-
do timer.start(ms, 0) |timer, status| {
228-
assert!(status.is_none());
229-
timer.close(||());
230-
f();
231-
}
232-
}
233-
234225
fn remote_callback(&mut self, f: ~fn()) -> ~RemoteCallback {
235226
~UvRemoteCallback::new(self.uvio.uv_loop(), f) as ~RemoteCallback
236227
}

0 commit comments

Comments
 (0)