Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Fixed IO service shutdown (#3286)
Browse files Browse the repository at this point in the history
  • Loading branch information
arkpar committed Nov 8, 2016
1 parent b3e0897 commit 2da4368
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions util/io/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,9 @@ impl<Message> IoService<Message> where Message: Send + Sync + Clone + 'static {
impl<Message> Drop for IoService<Message> where Message: Send + Sync + Clone {
fn drop(&mut self) {
trace!(target: "shutdown", "[IoService] Closing...");
// Clear handlers so that shared pointers are not stuck on stack
// in Channel::send_sync
self.handlers.write().clear();
self.host_channel.lock().send(IoMessage::Shutdown).unwrap_or_else(|e| warn!("Error on IO service shutdown: {:?}", e));
if let Some(thread) = self.thread.take() {
thread.join().unwrap_or_else(|e| {
Expand Down

0 comments on commit 2da4368

Please sign in to comment.