[sm_recursive] Fix bug that allowed the same block to be allocated twice.
See issue 70. Soln from mingnus.
This commit is contained in:
parent
0f2918e989
commit
4cdffafe88
@ -97,6 +97,12 @@ namespace {
|
||||
add_op(b, block_op(SET, c));
|
||||
else {
|
||||
recursing_lock lock(*this);
|
||||
|
||||
// the inner set_count may trigger a find_free,
|
||||
// so it's important we update the allocated
|
||||
// blocks list before calling.
|
||||
allocated_blocks_.add(b, b + 1);
|
||||
|
||||
return sm_->set_count(b, c);
|
||||
}
|
||||
}
|
||||
@ -111,6 +117,12 @@ namespace {
|
||||
add_op(b, block_op(INC, count));
|
||||
else {
|
||||
recursing_lock lock(*this);
|
||||
|
||||
// the inner inc() may trigger a find_free,
|
||||
// so it's important we update the allocated
|
||||
// blocks list before calling.
|
||||
allocated_blocks_.add(b, b + 1);
|
||||
|
||||
return sm_->inc(b, count);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user