Skip to content

Commit 6d3ca5a

Browse files
committed
remove poll function
1 parent f960776 commit 6d3ca5a

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/rt/runtime.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -133,19 +133,6 @@ impl Runtime {
133133
}
134134
Ok(false)
135135
}
136-
137-
fn poll(&self) -> io::Result<bool> {
138-
let mut sched = self.sched.lock().unwrap();
139-
sched.polling = true;
140-
drop(sched);
141-
142-
let result = self.reactor.poll(None);
143-
144-
let mut sched = self.sched.lock().unwrap();
145-
sched.polling = false;
146-
147-
result
148-
}
149136
}
150137

151138
/// A thread running a processor.
@@ -270,7 +257,20 @@ impl Machine {
270257
continue;
271258
}
272259

273-
rt.poll().unwrap();
260+
let mut sched = rt.sched.lock().unwrap();
261+
262+
if sched.polling {
263+
thread::sleep(Duration::from_micros(10));
264+
continue;
265+
}
266+
267+
sched.polling = true;
268+
drop(sched);
269+
270+
rt.reactor.poll(None).unwrap();
271+
272+
let mut sched = rt.sched.lock().unwrap();
273+
sched.polling = false;
274274

275275
runs = 0;
276276
fails = 0;

0 commit comments

Comments
 (0)