diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-20 20:15:16 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-20 20:15:16 +0400 |
commit | 7759b2743a5a41c16fd4ddc2943ba49c70a078b5 (patch) | |
tree | a3bafce72aa9900a5b7e40628d09f9a686f49178 /source/blender/blenlib | |
parent | 3758193c18a886faa5bb803dd378f24866e793e5 (diff) |
code cleanup: replace PARALLEL define with _OPENMP
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/CMakeLists.txt | 4 | ||||
-rw-r--r-- | source/blender/blenlib/SConscript | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/threads.c | 10 |
3 files changed, 7 insertions, 11 deletions
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index a9955f15016..0708b2fed4d 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -167,10 +167,6 @@ if(WITH_BINRELOC) add_definitions(-DWITH_BINRELOC) endif() -if(WITH_OPENMP) - add_definitions(-DPARALLEL=1) -endif() - if(WIN32) list(APPEND INC ../../../intern/utfconv diff --git a/source/blender/blenlib/SConscript b/source/blender/blenlib/SConscript index 41a9fe9e8b4..0a2c3c0ebca 100644 --- a/source/blender/blenlib/SConscript +++ b/source/blender/blenlib/SConscript @@ -50,8 +50,4 @@ if env['OURPLATFORM'] == 'linuxcross': if env['WITH_BF_OPENMP']: incs += ' ' + env['BF_OPENMP_INC'] -if env['OURPLATFORM'] == 'darwin': - if env['WITH_BF_OPENMP']: - env.Append(CFLAGS=['-DPARALLEL=1']) - env.BlenderLib ( 'bf_blenlib', sources, Split(incs), Split(defs), libtype=['core','player'], priority = [370,230], compileflags =cflags ) diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index 84a8af71dd5..e0ea3bbf685 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -53,7 +53,11 @@ # include <sys/time.h> #endif -#if defined(__APPLE__) && (PARALLEL == 1) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2) +#if defined(__APPLE__) && defined(_OPENMP) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2) +# define USE_APPLE_OMP_FIX +#endif + +#ifdef USE_APPLE_OMP_FIX /* ************** libgomp (Apple gcc 4.2.1) TLS bug workaround *************** */ extern pthread_key_t gomp_tls_key; static void *thread_tls_data; @@ -168,7 +172,7 @@ void BLI_init_threads(ListBase *threadbase, void *(*do_thread)(void *), int tot) 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) +#ifdef USE_APPLE_OMP_FIX /* 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 */ @@ -209,7 +213,7 @@ static void *tslot_thread_start(void *tslot_p) { ThreadSlot *tslot = (ThreadSlot *)tslot_p; -#if defined(__APPLE__) && (PARALLEL == 1) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2) +#ifdef USE_APPLE_OMP_FIX /* workaround for Apple gcc 4.2.1 omp vs background thread bug, * set gomp thread local storage pointer which was copied beforehand */ pthread_setspecific(gomp_tls_key, thread_tls_data); |