diff --git a/src/kits/support/BlockCache.cpp b/src/kits/support/BlockCache.cpp index a509382b27..f54b4d9c0b 100644 --- a/src/kits/support/BlockCache.cpp +++ b/src/kits/support/BlockCache.cpp @@ -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))