Commit 1c2644fb authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

refs #5833 don't return from allocate_counter without unlocking


git-svn-id: file:///svn/toku/tokudb@51425 c7de825b-a66e-492c-adef-691d508d4ae1
parent 32698fa9
......@@ -210,17 +210,21 @@ static uint64_t allocate_counter (void)
// Effect: Find an unused counter number, and allocate it, returning the counter number.
// Grabs the pc_lock.
{
pc_lock();
uint64_t ret;
pc_lock();
size_t size = counters_in_use.get_size();
for (uint64_t i=0; i<size; i++) {
if (!counters_in_use.fetch_unchecked(i)) {
counters_in_use.store_unchecked(i, true);
return i;
ret = i;
goto unlock;
}
}
counters_in_use.push(true);
pc_unlock();
return size;
ret = size;
unlock:
pc_unlock();
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment