Change the profiler loop to use try_recv so that the task

will exit during shutdown instead of crashing trying to
recv on a closed port.
This commit is contained in:
Lars Bergstrom 2013-08-23 10:34:32 -05:00
parent a074267e23
commit ecfa798abc

View file

@ -131,8 +131,11 @@ impl Profiler {
pub fn start(&mut self) {
loop {
let msg = self.port.recv();
self.handle_msg(msg);
let msg = self.port.try_recv();
match msg {
Some (msg) => self.handle_msg(msg),
None => break
}
}
}