Browse Source

Proper ifdef guards for raw block creation mutexes

Ioannis Koutras 13 years ago
parent
commit
2d5445c95e
1 changed files with 1 additions and 4 deletions
  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;