BBlockCache: Initialize the mutex unconditionally.

Otherwise we may get assertion failures under the debug heaps.
This commit is contained in:
Augustin Cavalier
2026-03-23 14:07:18 -04:00
parent 007fba2312
commit 89c3592b51
+2 -2
View File
@@ -45,6 +45,8 @@ BBlockCache::BBlockCache(uint32 blockCount, size_t blockSize,
fFreeBlocks(0),
fBlockCount(blockCount)
{
pthread_mutex_init(&fLock, NULL);
switch (allocationType) {
case B_OBJECT_CACHE:
fAlloc = &operator new[];
@@ -61,8 +63,6 @@ BBlockCache::BBlockCache(uint32 blockCount, size_t blockSize,
if (heap_debug_get_allocation_info != NULL)
return;
pthread_mutex_init(&fLock, NULL);
// To properly maintain a list of free buffers, a buffer must be
// large enough to contain the _FreeBlock struct that is used.
if (blockSize < sizeof(_FreeBlock))