From 7911849c70a63801534976486356b8c9aaefba86 Mon Sep 17 00:00:00 2001 From: Haomai Wang Date: Sat, 25 Jun 2016 13:25:51 +0800 Subject: [PATCH] msg/simple: wait dispatch_queue until all pipes closed Otherwise accepter may continue to accept new connection which may queue new item. Signed-off-by: Haomai Wang --- src/msg/simple/SimpleMessenger.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/msg/simple/SimpleMessenger.cc b/src/msg/simple/SimpleMessenger.cc index 6872750a0cd4e5..226512e05cc9cc 100644 --- a/src/msg/simple/SimpleMessenger.cc +++ b/src/msg/simple/SimpleMessenger.cc @@ -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; @@ -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;