{
ldout(cct,10) << "shutdown " << get_myaddr() << dendl;
mark_down_all();
- dispatch_queue.shutdown();
// break ref cycles on the loopback connection
local_connection->set_priv(NULL);
+
+ lock.Lock();
+ stop_cond.Signal();
+ stopped = true;
+ lock.Unlock();
+
return 0;
}
assert(!started);
started = true;
+ stopped = false;
if (!did_bind) {
my_inst.addr.nonce = nonce;
lock.Unlock();
return;
}
- lock.Unlock();
+ if (!stopped)
+ stop_cond.Wait(lock);
- 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;
- }
+ lock.Unlock();
// done! clean up.
if (did_bind) {
ldout(cct,20) << "wait: stopped accepter thread" << dendl;
}
+ dispatch_queue.shutdown();
+ 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;
+ }
+
if (reaper_started) {
ldout(cct,20) << "wait: stopping reaper thread" << dendl;
lock.Lock();
/// internal cluster protocol version, if any, for talking to entities of the same type.
int cluster_protocol;
+ Cond stop_cond;
+ bool stopped = true;
+
bool reaper_started, reaper_stop;
Cond reaper_cond;