Skip to content

Commit

Permalink
msg/simple: wait dispatch_queue until all pipes closed
Browse files Browse the repository at this point in the history
Otherwise accepter may continue to accept new connection which may queue
new item.

Signed-off-by: Haomai Wang <haomai@xsky.com>
  • Loading branch information
yuyuyu101 committed Jun 25, 2016
1 parent 48d1803 commit 7911849
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/msg/simple/SimpleMessenger.cc
Expand Up @@ -527,13 +527,6 @@ void SimpleMessenger::wait()
}
lock.Unlock();

if (dispatch_queue.is_started()) {
ldout(cct,10) << "wait: waiting for dispatch queue" << dendl;
dispatch_queue.wait();
dispatch_queue.discard_local();
ldout(cct,10) << "wait: dispatch queue is stopped" << dendl;
}

// done! clean up.
if (did_bind) {
ldout(cct,20) << "wait: stopping accepter thread" << dendl;
Expand Down Expand Up @@ -575,6 +568,13 @@ void SimpleMessenger::wait()
}
lock.Unlock();

if (dispatch_queue.is_started()) {
ldout(cct,10) << "wait: waiting for dispatch queue" << dendl;
dispatch_queue.wait();
dispatch_queue.discard_local();
ldout(cct,10) << "wait: dispatch queue is stopped" << dendl;
}

ldout(cct,10) << "wait: done." << dendl;
ldout(cct,1) << "shutdown complete." << dendl;
started = false;
Expand Down

0 comments on commit 7911849

Please sign in to comment.