[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28830] branches/render25/source/blender/ blenlib/intern/threads.c: BLI_init_threads/ BLI_end_threads with NULL listbase now raises thread level
Brecht Van Lommel
brecht at blender.org
Tue May 18 16:38:40 CEST 2010
Revision: 28830
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28830
Author: blendix
Date: 2010-05-18 16:38:36 +0200 (Tue, 18 May 2010)
Log Message:
-----------
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.
Modified Paths:
--------------
branches/render25/source/blender/blenlib/intern/threads.c
Modified: branches/render25/source/blender/blenlib/intern/threads.c
===================================================================
--- branches/render25/source/blender/blenlib/intern/threads.c 2010-05-18 14:38:25 UTC (rev 28829)
+++ branches/render25/source/blender/blenlib/intern/threads.c 2010-05-18 14:38:36 UTC (rev 28830)
@@ -158,20 +158,20 @@
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 */
@@ -290,11 +290,11 @@
}
}
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 */
More information about the Bf-blender-cvs
mailing list