浏览代码

Proper ifdef guards for raw block creation mutexes

Ioannis Koutras 13 年之前
父节点
当前提交
2d5445c95e
共有 1 个文件被更改,包括 1 次插入4 次删除
  1. 1 4
      src/malloc.c

+ 1 - 4
src/malloc.c

@@ -142,8 +142,8 @@ void * malloc(size_t size) {
         if(new_raw_block != NULL) {
             new_raw_block->next_raw_block = systemallocator.raw_block_head;
             systemallocator.raw_block_head = new_raw_block;
-            pthread_mutex_unlock(&systemallocator.creation_mutex);
 #ifdef HAVE_LOCKS
+            pthread_mutex_unlock(&systemallocator.creation_mutex);
             pthread_mutex_lock(&new_raw_block->mutex);
 #endif /* HAVE_LOCKS */
 
@@ -160,9 +160,6 @@ void * malloc(size_t size) {
             pthread_mutex_unlock(&new_raw_block->mutex);
 #endif /* HAVE_LOCKS */
         }
-#ifdef HAVE_LOCKS
-        pthread_mutex_unlock(&systemallocator.creation_mutex);
-#endif /* HAVE_LOCKS */
     }
     
     return ptr;