mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 00:56:44 +01:00
mostly adding asserts and a little clarifying
This commit is contained in:
parent
532ebd514a
commit
5cb82809ab
@ -69,18 +69,19 @@ namespace mongo {
|
||||
*/
|
||||
void invoke() {
|
||||
mutex::scoped_lock lk2(_invokeMutex);
|
||||
|
||||
int toDrain;
|
||||
{
|
||||
// flip queueing to the other queue (we are double buffered)
|
||||
readlocktry lk("", 1);
|
||||
if (lk.got()){
|
||||
int other = _which ^ 1;
|
||||
if( _queues[other].empty() )
|
||||
_which = other;
|
||||
}
|
||||
readlocktry lk("", 5);
|
||||
if( !lk.got() )
|
||||
return;
|
||||
toDrain = _which;
|
||||
_which = _which ^ 1;
|
||||
wassert( _queues[_which].empty() ); // we are in dbMutex, so it should be/stay empty til we exit dbMutex
|
||||
}
|
||||
|
||||
_drain( _queues[_which^1] );
|
||||
_drain( _queues[toDrain] );
|
||||
assert( _queues[toDrain].empty() );
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user