fix deadlock after merge

This commit is contained in:
keorn 2016-11-01 17:52:52 +00:00
parent fc4664ab12
commit a33e2f2e0d

View File

@ -249,7 +249,8 @@ impl<Message> Handler for IoManager<Message> where Message: Send + Clone + Sync
let handler_index = token.0 / TOKENS_PER_HANDLER;
let token_id = token.0 % TOKENS_PER_HANDLER;
if let Some(handler) = self.handlers.read().get(handler_index) {
if let Some(timer) = self.timers.read().get(&token.0) {
let maybe_timer = self.timers.read().get(&token.0).cloned();
if let Some(timer) = maybe_timer {
if timer.once {
self.timers.write().remove(&token_id);
event_loop.clear_timeout(&timer.timeout);