Skip to content

Commit e075fe5

Browse files
committed
lock the Disjoint Pool bucket before accessing its internals
1 parent 8770108 commit e075fe5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/pools/disjoint_pool.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ TEST_F(test, internals) {
138138
EXPECT_NE(bucket, nullptr);
139139

140140
// check bucket stats
141+
// NOTE: we have to lock the bucket to properly access its internals
142+
utils_mutex_lock(&bucket->bucket_lock);
141143
EXPECT_EQ(bucket->alloc_count, 1);
142144

143145
// first allocation will always use external memory (newly added to the
@@ -160,6 +162,8 @@ TEST_F(test, internals) {
160162
EXPECT_EQ(slab->chunks[1], false);
161163
EXPECT_EQ(slab->first_free_chunk_idx, 1);
162164

165+
utils_mutex_unlock(&bucket->bucket_lock);
166+
163167
// TODO:
164168
// * multiple alloc + free from single bucket
165169
// * alignments

0 commit comments

Comments
 (0)