Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-06-22 19:17:12 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-06-22 19:17:12 +0400
commited28a0296fc98411da11243f20698be7f7f645cf (patch)
tree72f37b512445f11538c9de888ce31e9628e76e4e /source/blender/blenlib
parentc45c6a20a4a3cd6920586fb5b8d1d1e79b1be419 (diff)
BLI_init_threads/BLI_end_threads with NULL listbase now raises thread level
and enables mutex protection on MEM_* functions, useful when you want to call these functions from an OpenMP thread. (merge from render25 branch)
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/threads.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index 0ad6f84e8f0..726ed817f8b 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -158,20 +158,20 @@ void BLI_init_threads(ListBase *threadbase, void *(*do_thread)(void *), int tot)
tslot->do_thread= do_thread;
tslot->avail= 1;
}
-
- if(thread_levels == 0) {
- MEM_set_lock_callback(BLI_lock_malloc_thread, BLI_unlock_malloc_thread);
+ }
+
+ if(thread_levels == 0) {
+ MEM_set_lock_callback(BLI_lock_malloc_thread, BLI_unlock_malloc_thread);
#if defined(__APPLE__) && (PARALLEL == 1) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
- /* workaround for Apple gcc 4.2.1 omp vs background thread bug,
- we copy gomp thread local storage pointer to setting it again
- inside the thread that we start */
- thread_tls_data = pthread_getspecific(gomp_tls_key);
+ /* workaround for Apple gcc 4.2.1 omp vs background thread bug,
+ we copy gomp thread local storage pointer to setting it again
+ inside the thread that we start */
+ thread_tls_data = pthread_getspecific(gomp_tls_key);
#endif
- }
-
- thread_levels++;
}
+
+ thread_levels++;
}
/* amount of available threads */
@@ -287,11 +287,11 @@ void BLI_end_threads(ListBase *threadbase)
}
}
BLI_freelistN(threadbase);
-
- thread_levels--;
- if(thread_levels==0)
- MEM_set_lock_callback(NULL, NULL);
}
+
+ thread_levels--;
+ if(thread_levels==0)
+ MEM_set_lock_callback(NULL, NULL);
}
/* System Information */