0
0
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:
dwight 2011-01-10 17:07:39 -05:00
parent 532ebd514a
commit 5cb82809ab

View File

@ -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: