Skip to content

Commit

Permalink
Merge pull request rust-lang#282 from alexcrichton/fix-deadlock
Browse files Browse the repository at this point in the history
Check for channel close after a park
  • Loading branch information
alexcrichton authored Dec 8, 2016
2 parents f2a3809 + 5f53404 commit b22e86c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/sync/mpsc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,12 +413,16 @@ impl<T> Sender<T> {
None
};

self.maybe_parked = true;
*self.sender_task.lock().unwrap() = task;

// Send handle over queue
let t = self.sender_task.clone();
self.inner.parked_queue.push(t);

// Check to make sure we weren't closed after we sent our task on the
// queue
let state = decode_state(self.inner.state.load(SeqCst));
self.maybe_parked = state.is_open;
}

fn poll_unparked(&mut self) -> Async<()> {
Expand Down

0 comments on commit b22e86c

Please sign in to comment.