mirror of
https://github.com/async-rs/async-std.git
synced 2025-05-15 03:21:28 +00:00
remove poll function
This commit is contained in:
parent
f960776846
commit
6d3ca5a06f
1 changed files with 14 additions and 14 deletions
|
@ -133,19 +133,6 @@ impl Runtime {
|
||||||
}
|
}
|
||||||
Ok(false)
|
Ok(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn poll(&self) -> io::Result<bool> {
|
|
||||||
let mut sched = self.sched.lock().unwrap();
|
|
||||||
sched.polling = true;
|
|
||||||
drop(sched);
|
|
||||||
|
|
||||||
let result = self.reactor.poll(None);
|
|
||||||
|
|
||||||
let mut sched = self.sched.lock().unwrap();
|
|
||||||
sched.polling = false;
|
|
||||||
|
|
||||||
result
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A thread running a processor.
|
/// A thread running a processor.
|
||||||
|
@ -270,7 +257,20 @@ impl Machine {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
rt.poll().unwrap();
|
let mut sched = rt.sched.lock().unwrap();
|
||||||
|
|
||||||
|
if sched.polling {
|
||||||
|
thread::sleep(Duration::from_micros(10));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
sched.polling = true;
|
||||||
|
drop(sched);
|
||||||
|
|
||||||
|
rt.reactor.poll(None).unwrap();
|
||||||
|
|
||||||
|
let mut sched = rt.sched.lock().unwrap();
|
||||||
|
sched.polling = false;
|
||||||
|
|
||||||
runs = 0;
|
runs = 0;
|
||||||
fails = 0;
|
fails = 0;
|
||||||
|
|
Loading…
Reference in a new issue