diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-01-24 12:14:05 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-01-24 12:14:05 +0400 |
commit | 5e739ddae2cc5fdb30e62544bfdd5b55284962a5 (patch) | |
tree | f3a449a1d591513cd87a7671dbc0fa2bea556dc5 /source/blender | |
parent | c65c1958bde6425cedb810590d64252adc2e56c3 (diff) |
Added some code which helps troubleshooting issues caused by
non-threadsafe usage of guarded allocator.
Also added small chunk of code to check consistency of begin/end
threaded malloc.
All this additional checks are commented and wouldn't affect on
builds, however found them helpful to troubleshoot issues so
decided to commit it to SVN.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenlib/intern/threads.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index 146e1d531f1..686484ef1db 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -729,6 +729,9 @@ void BLI_thread_queue_wait_finish(ThreadQueue *queue) void BLI_begin_threaded_malloc(void) { + /* Used for debug only */ + /* BLI_assert(thread_levels >= 0); */ + if (thread_levels == 0) { MEM_set_lock_callback(BLI_lock_malloc_thread, BLI_unlock_malloc_thread); } @@ -737,6 +740,9 @@ void BLI_begin_threaded_malloc(void) void BLI_end_threaded_malloc(void) { + /* Used for debug only */ + /* BLI_assert(thread_levels >= 0); */ + thread_levels--; if (thread_levels == 0) MEM_set_lock_callback(NULL, NULL); |