Merge with trunk r41625
[blender.git] / source / blender / blenlib / intern / threads.c
index 8247b86..38b3fe6 100644 (file)
@@ -669,3 +669,17 @@ void BLI_thread_queue_nowait(ThreadQueue *queue)
        pthread_mutex_unlock(&queue->mutex);
 }
 
+void BLI_begin_threaded_malloc(void)
+{
+       if(thread_levels == 0) {
+               MEM_set_lock_callback(BLI_lock_malloc_thread, BLI_unlock_malloc_thread);
+       }
+       thread_levels++;
+}
+
+void BLI_end_threaded_malloc(void)
+{
+       thread_levels--;
+       if(thread_levels==0)
+               MEM_set_lock_callback(NULL, NULL);
+}
\ No newline at end of file