diff options
Diffstat (limited to 'source/blender/blenlib/intern/threads.c')
-rw-r--r-- | source/blender/blenlib/intern/threads.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index 8247b861a7a..38b3fe669b6 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -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 |