msg/DispachQueue: hold lock in IncomingQueue::discard_queue()

This prevents races with the dispatch thread, among other things.

Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Sage Weil 2012-07-15 18:45:55 -07:00
parent 35b7bca357
commit 5a62dfef3d

View File

@ -92,6 +92,8 @@ void IncomingQueue::discard_queue()
// dequeue ourselves
dq->lock.Lock();
lock.Lock();
for (map<int, xlist<IncomingQueue *>::item* >::iterator i = queue_items.begin();
i != queue_items.end();
++i) {
@ -125,6 +127,8 @@ void IncomingQueue::discard_queue()
}
in_q.clear();
in_qlen = 0;
lock.Unlock();
}
void IncomingQueue::restart_queue()