...in the case where no dispatchers were ever added, previously
we would throw an assertion in wait().
Signed-off-by: John Spray <john.spray@inktank.com>
// wait for thread to stop before closing the socket, to avoid
// racing against fd re-use.
- join();
+ if (is_started()) {
+ join();
+ }
if (listen_sd >= 0) {
::close(listen_sd);
void entry();
void wait();
void shutdown();
+ bool is_started() {return dispatch_thread.is_started();}
DispatchQueue(CephContext *cct, SimpleMessenger *msgr)
: cct(cct), msgr(msgr),
}
lock.Unlock();
- ldout(cct,10) << "wait: waiting for dispatch queue" << dendl;
- dispatch_queue.wait();
- ldout(cct,10) << "wait: dispatch queue is stopped" << dendl;
-
+ if(dispatch_queue.is_started()) {
+ ldout(cct,10) << "wait: waiting for dispatch queue" << dendl;
+ dispatch_queue.wait();
+ ldout(cct,10) << "wait: dispatch queue is stopped" << dendl;
+ }
+
// done! clean up.
if (did_bind) {
ldout(cct,20) << "wait: stopping accepter thread" << dendl;