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:
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c4
-rw-r--r--source/blender/blenkernel/intern/image.c16
-rw-r--r--source/blender/blenkernel/intern/movieclip.c20
-rw-r--r--source/blender/blenkernel/intern/ocean.c8
-rw-r--r--source/blender/blenkernel/intern/smoke.c4
-rw-r--r--source/blender/blenkernel/intern/softbody.c12
-rw-r--r--source/blender/blenkernel/intern/tracking_util.c4
-rw-r--r--source/blender/blenlib/BLI_threads.h22
-rw-r--r--source/blender/blenlib/intern/task.c4
-rw-r--r--source/blender/blenlib/intern/threads.c30
-rw-r--r--source/blender/compositor/intern/COM_WorkScheduler.cpp12
-rw-r--r--source/blender/compositor/operations/COM_CompositorOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ViewerOperation.cpp6
-rw-r--r--source/blender/editors/object/object_bake.c6
-rw-r--r--source/blender/editors/render/render_internal.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c18
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c8
-rw-r--r--source/blender/editors/space_image/image_draw.c4
-rw-r--r--source/blender/editors/space_image/space_image.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c8
-rw-r--r--source/blender/gpu/intern/gpu_draw.c8
-rw-r--r--source/blender/imbuf/intern/colormanagement.c14
-rw-r--r--source/blender/imbuf/intern/thumbs.c16
-rw-r--r--source/blender/nodes/shader/node_shader_tree.c4
-rw-r--r--source/blender/nodes/texture/node_texture_tree.c4
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_image.c4
-rw-r--r--source/blender/render/intern/source/bake.c16
-rw-r--r--source/blender/render/intern/source/envmap.c4
-rw-r--r--source/blender/render/intern/source/external_engine.c4
-rw-r--r--source/blender/render/intern/source/imagetexture.c8
-rw-r--r--source/blender/render/intern/source/multires_bake.c6
-rw-r--r--source/blender/render/intern/source/occlusion.c16
-rw-r--r--source/blender/render/intern/source/pipeline.c6
-rw-r--r--source/blender/render/intern/source/render_result.c4
-rw-r--r--source/blender/render/intern/source/render_texture.c4
-rw-r--r--source/blender/render/intern/source/shadbuf.c22
-rw-r--r--source/blender/render/intern/source/sss.c4
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c8
-rw-r--r--source/creator/creator_args.c8
-rw-r--r--source/gameengine/VideoTexture/VideoFFmpeg.cpp6
40 files changed, 182 insertions, 182 deletions
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 41a5d8574e6..011e58b2349 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -4557,7 +4557,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
}
/* begin thread safe malloc */
- BLI_begin_threaded_malloc();
+ BLI_threaded_malloc_begin();
/* only continue if particle bb is close enough to canvas bb */
if (boundsIntersectDist(&grid->grid_bounds, &part_bb, range)) {
@@ -4592,7 +4592,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
&settings);
}
}
- BLI_end_threaded_malloc();
+ BLI_threaded_malloc_end();
BLI_kdtree_free(tree);
return 1;
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index bd2373a59d5..64f25cdcf53 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -2547,7 +2547,7 @@ void BKE_image_verify_viewer_views(const RenderData *rd, Image *ima, ImageUser *
bool do_reset;
const bool is_multiview = (rd->scemode & R_MULTIVIEW) != 0;
- BLI_lock_thread(LOCK_DRAW_IMAGE);
+ BLI_thread_lock(LOCK_DRAW_IMAGE);
if (!BKE_scene_multiview_is_stereo3d(rd))
iuser->flag &= ~IMA_SHOW_STEREO;
@@ -2581,7 +2581,7 @@ void BKE_image_verify_viewer_views(const RenderData *rd, Image *ima, ImageUser *
BLI_spin_unlock(&image_spin);
}
- BLI_unlock_thread(LOCK_DRAW_IMAGE);
+ BLI_thread_unlock(LOCK_DRAW_IMAGE);
}
void BKE_image_walk_all_users(const Main *mainp, void *customdata,
@@ -3662,7 +3662,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **r_loc
/* release is done in BKE_image_release_ibuf using r_lock */
if (from_render) {
- BLI_lock_thread(LOCK_VIEWER);
+ BLI_thread_lock(LOCK_VIEWER);
*r_lock = re;
rv = NULL;
}
@@ -3755,7 +3755,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **r_loc
}
/* invalidate color managed buffers if render result changed */
- BLI_lock_thread(LOCK_COLORMANAGE);
+ BLI_thread_lock(LOCK_COLORMANAGE);
if (ibuf->x != rres.rectx || ibuf->y != rres.recty || ibuf->rect_float != rectf) {
ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
}
@@ -3796,7 +3796,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **r_loc
ibuf->flags &= ~IB_zbuffloat;
}
- BLI_unlock_thread(LOCK_COLORMANAGE);
+ BLI_thread_unlock(LOCK_COLORMANAGE);
ibuf->dither = dither;
@@ -3998,7 +3998,7 @@ static ImBuf *image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
/* requires lock/unlock, otherwise don't return image */
if (r_lock) {
/* unlock in BKE_image_release_ibuf */
- BLI_lock_thread(LOCK_VIEWER);
+ BLI_thread_lock(LOCK_VIEWER);
*r_lock = ima;
/* XXX anim play for viewer nodes not yet supported */
@@ -4051,11 +4051,11 @@ void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
if (lock) {
/* for getting image during threaded render / compositing, need to release */
if (lock == ima) {
- BLI_unlock_thread(LOCK_VIEWER); /* viewer image */
+ BLI_thread_unlock(LOCK_VIEWER); /* viewer image */
}
else if (lock) {
RE_ReleaseResultImage(lock); /* render result */
- BLI_unlock_thread(LOCK_VIEWER); /* view image imbuf */
+ BLI_thread_unlock(LOCK_VIEWER); /* view image imbuf */
}
}
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 08df976941b..a416de07c6d 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -926,7 +926,7 @@ static ImBuf *movieclip_get_postprocessed_ibuf(MovieClip *clip,
/* cache isn't threadsafe itself and also loading of movies
* can't happen from concurrent threads that's why we use lock here */
- BLI_lock_thread(LOCK_MOVIECLIP);
+ BLI_thread_lock(LOCK_MOVIECLIP);
/* try to obtain cached postprocessed frame first */
if (need_postprocessed_frame(user, postprocess_flag)) {
@@ -976,7 +976,7 @@ static ImBuf *movieclip_get_postprocessed_ibuf(MovieClip *clip,
}
}
- BLI_unlock_thread(LOCK_MOVIECLIP);
+ BLI_thread_unlock(LOCK_MOVIECLIP);
return ibuf;
}
@@ -1410,13 +1410,13 @@ static void movieclip_build_proxy_ibuf(MovieClip *clip, ImBuf *ibuf, int cfra, i
* could be solved in a way that thread only prepares memory
* buffer and write to disk happens separately
*/
- BLI_lock_thread(LOCK_MOVIECLIP);
+ BLI_thread_lock(LOCK_MOVIECLIP);
BLI_make_existing_file(name);
if (IMB_saveiff(scaleibuf, name, IB_rect) == 0)
perror(name);
- BLI_unlock_thread(LOCK_MOVIECLIP);
+ BLI_thread_unlock(LOCK_MOVIECLIP);
IMB_freeImBuf(scaleibuf);
}
@@ -1560,9 +1560,9 @@ ImBuf *BKE_movieclip_anim_ibuf_for_frame(MovieClip *clip, MovieClipUser *user)
ImBuf *ibuf = NULL;
if (clip->source == MCLIP_SRC_MOVIE) {
- BLI_lock_thread(LOCK_MOVIECLIP);
+ BLI_thread_lock(LOCK_MOVIECLIP);
ibuf = movieclip_load_movie_file(clip, user, user->framenr, clip->flag);
- BLI_unlock_thread(LOCK_MOVIECLIP);
+ BLI_thread_unlock(LOCK_MOVIECLIP);
}
return ibuf;
@@ -1572,9 +1572,9 @@ bool BKE_movieclip_has_cached_frame(MovieClip *clip, MovieClipUser *user)
{
bool has_frame = false;
- BLI_lock_thread(LOCK_MOVIECLIP);
+ BLI_thread_lock(LOCK_MOVIECLIP);
has_frame = has_imbuf_cache(clip, user, clip->flag);
- BLI_unlock_thread(LOCK_MOVIECLIP);
+ BLI_thread_unlock(LOCK_MOVIECLIP);
return has_frame;
}
@@ -1585,9 +1585,9 @@ bool BKE_movieclip_put_frame_if_possible(MovieClip *clip,
{
bool result;
- BLI_lock_thread(LOCK_MOVIECLIP);
+ BLI_thread_lock(LOCK_MOVIECLIP);
result = put_imbuf_cache(clip, user, ibuf, clip->flag, false);
- BLI_unlock_thread(LOCK_MOVIECLIP);
+ BLI_thread_unlock(LOCK_MOVIECLIP);
return result;
}
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index 0b4bc39627e..2d8527f23d6 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -917,7 +917,7 @@ void BKE_ocean_init(struct Ocean *o, int M, int N, float Lx, float Lz, float V,
o->_fft_in = (fftw_complex *)MEM_mallocN(o->_M * (1 + o->_N / 2) * sizeof(fftw_complex), "ocean_fft_in");
o->_htilda = (fftw_complex *)MEM_mallocN(o->_M * (1 + o->_N / 2) * sizeof(fftw_complex), "ocean_htilda");
- BLI_lock_thread(LOCK_FFTW);
+ BLI_thread_lock(LOCK_FFTW);
if (o->_do_disp_y) {
o->_disp_y = (double *)MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_disp_y");
@@ -963,7 +963,7 @@ void BKE_ocean_init(struct Ocean *o, int M, int N, float Lx, float Lz, float V,
o->_Jxz_plan = fftw_plan_dft_c2r_2d(o->_M, o->_N, o->_fft_in_jxz, o->_Jxz, FFTW_ESTIMATE);
}
- BLI_unlock_thread(LOCK_FFTW);
+ BLI_thread_unlock(LOCK_FFTW);
BLI_rw_mutex_unlock(&o->oceanmutex);
@@ -978,7 +978,7 @@ void BKE_ocean_free_data(struct Ocean *oc)
BLI_rw_mutex_lock(&oc->oceanmutex, THREAD_LOCK_WRITE);
- BLI_lock_thread(LOCK_FFTW);
+ BLI_thread_lock(LOCK_FFTW);
if (oc->_do_disp_y) {
fftw_destroy_plan(oc->_disp_y_plan);
@@ -1016,7 +1016,7 @@ void BKE_ocean_free_data(struct Ocean *oc)
MEM_freeN(oc->_Jxz);
}
- BLI_unlock_thread(LOCK_FFTW);
+ BLI_thread_unlock(LOCK_FFTW);
if (oc->_fft_in)
MEM_freeN(oc->_fft_in);
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 34ff9a155b4..3adba9fbce8 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -168,11 +168,11 @@ void smoke_reallocate_highres_fluid(SmokeDomainSettings *sds, float dx, int res[
}
/* smoke_turbulence_init uses non-threadsafe functions from fftw3 lib (like fftw_plan & co). */
- BLI_lock_thread(LOCK_FFTW);
+ BLI_thread_lock(LOCK_FFTW);
sds->wt = smoke_turbulence_init(res, sds->amplify + 1, sds->noise, BKE_tempdir_session(), use_fire, use_colors);
- BLI_unlock_thread(LOCK_FFTW);
+ BLI_thread_unlock(LOCK_FFTW);
sds->res_wt[0] = res[0] * (sds->amplify + 1);
sds->res_wt[1] = res[1] * (sds->amplify + 1);
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 563148992d9..d798848e583 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -1602,12 +1602,12 @@ static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,
sb_threads[i].tot= totthread;
}
if (totthread > 1) {
- BLI_init_threads(&threads, exec_scan_for_ext_spring_forces, totthread);
+ BLI_threadpool_init(&threads, exec_scan_for_ext_spring_forces, totthread);
for (i=0; i<totthread; i++)
- BLI_insert_thread(&threads, &sb_threads[i]);
+ BLI_threadpool_insert(&threads, &sb_threads[i]);
- BLI_end_threads(&threads);
+ BLI_threadpool_end(&threads);
}
else
exec_scan_for_ext_spring_forces(&sb_threads[0]);
@@ -2214,12 +2214,12 @@ static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float t
if (totthread > 1) {
- BLI_init_threads(&threads, exec_softbody_calc_forces, totthread);
+ BLI_threadpool_init(&threads, exec_softbody_calc_forces, totthread);
for (i=0; i<totthread; i++)
- BLI_insert_thread(&threads, &sb_threads[i]);
+ BLI_threadpool_insert(&threads, &sb_threads[i]);
- BLI_end_threads(&threads);
+ BLI_threadpool_end(&threads);
}
else
exec_softbody_calc_forces(&sb_threads[0]);
diff --git a/source/blender/blenkernel/intern/tracking_util.c b/source/blender/blenkernel/intern/tracking_util.c
index d8e98291117..8c1b846db84 100644
--- a/source/blender/blenkernel/intern/tracking_util.c
+++ b/source/blender/blenkernel/intern/tracking_util.c
@@ -787,9 +787,9 @@ static ImBuf *accessor_get_ibuf(TrackingImageAccessor *accessor,
* in the cache which is nice on the one hand (faster re-use of the
* frames) but on the other hand it bumps the memory usage up.
*/
- BLI_lock_thread(LOCK_MOVIECLIP);
+ BLI_thread_lock(LOCK_MOVIECLIP);
IMB_float_from_rect(orig_ibuf);
- BLI_unlock_thread(LOCK_MOVIECLIP);
+ BLI_thread_unlock(LOCK_MOVIECLIP);
final_ibuf = orig_ibuf;
}
/* Downscale if needed. */
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h
index 84e25daa348..66eb5cfd22b 100644
--- a/source/blender/blenlib/BLI_threads.h
+++ b/source/blender/blenlib/BLI_threads.h
@@ -55,19 +55,19 @@ void BLI_threadapi_exit(void);
struct TaskScheduler *BLI_task_scheduler_get(void);
-void BLI_init_threads(struct ListBase *threadbase, void *(*do_thread)(void *), int tot);
+void BLI_threadpool_init(struct ListBase *threadbase, void *(*do_thread)(void *), int tot);
int BLI_available_threads(struct ListBase *threadbase);
-int BLI_available_thread_index(struct ListBase *threadbase);
-void BLI_insert_thread(struct ListBase *threadbase, void *callerdata);
-void BLI_remove_thread(struct ListBase *threadbase, void *callerdata);
-void BLI_remove_thread_index(struct ListBase *threadbase, int index);
-void BLI_remove_threads(struct ListBase *threadbase);
-void BLI_end_threads(struct ListBase *threadbase);
+int BLI_threadpool_available_thread_index(struct ListBase *threadbase);
+void BLI_threadpool_insert(struct ListBase *threadbase, void *callerdata);
+void BLI_threadpool_remove(struct ListBase *threadbase, void *callerdata);
+void BLI_threadpool_remove_index(struct ListBase *threadbase, int index);
+void BLI_threadpool_clear(struct ListBase *threadbase);
+void BLI_threadpool_end(struct ListBase *threadbase);
int BLI_thread_is_main(void);
-void BLI_begin_threaded_malloc(void);
-void BLI_end_threaded_malloc(void);
+void BLI_threaded_malloc_begin(void);
+void BLI_threaded_malloc_end(void);
/* System Information */
@@ -91,8 +91,8 @@ int BLI_system_num_threads_override_get(void);
#define LOCK_FFTW 9
#define LOCK_VIEW3D 10
-void BLI_lock_thread(int type);
-void BLI_unlock_thread(int type);
+void BLI_thread_lock(int type);
+void BLI_thread_unlock(int type);
/* Mutex Lock */
diff --git a/source/blender/blenlib/intern/task.c b/source/blender/blenlib/intern/task.c
index c892ffbfd4a..53c0c560c0d 100644
--- a/source/blender/blenlib/intern/task.c
+++ b/source/blender/blenlib/intern/task.c
@@ -696,7 +696,7 @@ static TaskPool *task_pool_create_ex(TaskScheduler *scheduler,
* and malloc could be non-thread safe at this point because
* no other jobs are running.
*/
- BLI_begin_threaded_malloc();
+ BLI_threaded_malloc_begin();
return pool;
}
@@ -763,7 +763,7 @@ void BLI_task_pool_free(TaskPool *pool)
MEM_freeN(pool);
- BLI_end_threaded_malloc();
+ BLI_threaded_malloc_end();
}
BLI_INLINE bool task_can_use_local_queues(TaskPool *pool, int thread_id)
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index 9dc458fa0b9..761f3982e28 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -83,13 +83,13 @@ static TaskScheduler *task_scheduler = NULL;
* int maxthreads = 2;
* int cont = 1;
*
- * BLI_init_threads(&lb, do_something_func, maxthreads);
+ * BLI_threadpool_init(&lb, do_something_func, maxthreads);
*
* while (cont) {
* if (BLI_available_threads(&lb) && !(escape loop event)) {
* // get new job (data pointer)
* // tag job 'processed
- * BLI_insert_thread(&lb, job);
+ * BLI_threadpool_insert(&lb, job);
* }
* else PIL_sleep_ms(50);
*
@@ -98,7 +98,7 @@ static TaskScheduler *task_scheduler = NULL;
* for (go over all jobs)
* if (job is ready) {
* if (job was not removed) {
- * BLI_remove_thread(&lb, job);
+ * BLI_threadpool_remove(&lb, job);
* }
* }
* else cont = 1;
@@ -110,7 +110,7 @@ static TaskScheduler *task_scheduler = NULL;
* }
* }
*
- * BLI_end_threads(&lb);
+ * BLI_threadpool_end(&lb);
*
************************************************ */
static SpinLock _malloc_lock;
@@ -183,7 +183,7 @@ TaskScheduler *BLI_task_scheduler_get(void)
* problem otherwise: scene render will kill of the mutex!
*/
-void BLI_init_threads(ListBase *threadbase, void *(*do_thread)(void *), int tot)
+void BLI_threadpool_init(ListBase *threadbase, void *(*do_thread)(void *), int tot)
{
int a;
@@ -228,7 +228,7 @@ int BLI_available_threads(ListBase *threadbase)
}
/* returns thread number, for sample patterns or threadsafe tables */
-int BLI_available_thread_index(ListBase *threadbase)
+int BLI_threadpool_available_thread_index(ListBase *threadbase)
{
ThreadSlot *tslot;
int counter = 0;
@@ -258,7 +258,7 @@ int BLI_thread_is_main(void)
return pthread_equal(pthread_self(), mainid);
}
-void BLI_insert_thread(ListBase *threadbase, void *callerdata)
+void BLI_threadpool_insert(ListBase *threadbase, void *callerdata)
{
ThreadSlot *tslot;
@@ -273,7 +273,7 @@ void BLI_insert_thread(ListBase *threadbase, void *callerdata)
printf("ERROR: could not insert thread slot\n");
}
-void BLI_remove_thread(ListBase *threadbase, void *callerdata)
+void BLI_threadpool_remove(ListBase *threadbase, void *callerdata)
{
ThreadSlot *tslot;
@@ -286,7 +286,7 @@ void BLI_remove_thread(ListBase *threadbase, void *callerdata)
}
}
-void BLI_remove_thread_index(ListBase *threadbase, int index)
+void BLI_threadpool_remove_index(ListBase *threadbase, int index)
{
ThreadSlot *tslot;
int counter = 0;
@@ -301,7 +301,7 @@ void BLI_remove_thread_index(ListBase *threadbase, int index)
}
}
-void BLI_remove_threads(ListBase *threadbase)
+void BLI_threadpool_clear(ListBase *threadbase)
{
ThreadSlot *tslot;
@@ -314,7 +314,7 @@ void BLI_remove_threads(ListBase *threadbase)
}
}
-void BLI_end_threads(ListBase *threadbase)
+void BLI_threadpool_end(ListBase *threadbase)
{
ThreadSlot *tslot;
@@ -418,12 +418,12 @@ static ThreadMutex *global_mutex_from_type(const int type)
}
}
-void BLI_lock_thread(int type)
+void BLI_thread_lock(int type)
{
pthread_mutex_lock(global_mutex_from_type(type));
}
-void BLI_unlock_thread(int type)
+void BLI_thread_unlock(int type)
{
pthread_mutex_unlock(global_mutex_from_type(type));
}
@@ -819,7 +819,7 @@ void BLI_thread_queue_wait_finish(ThreadQueue *queue)
/* ************************************************ */
-void BLI_begin_threaded_malloc(void)
+void BLI_threaded_malloc_begin(void)
{
unsigned int level = atomic_fetch_and_add_u(&thread_levels, 1);
if (level == 0) {
@@ -832,7 +832,7 @@ void BLI_begin_threaded_malloc(void)
}
}
-void BLI_end_threaded_malloc(void)
+void BLI_threaded_malloc_end(void)
{
unsigned int level = atomic_sub_and_fetch_u(&thread_levels, 1);
if (level == 0) {
diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp
index 68f934008a4..e2dc289eb1c 100644
--- a/source/blender/compositor/intern/COM_WorkScheduler.cpp
+++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp
@@ -131,18 +131,18 @@ void WorkScheduler::start(CompositorContext &context)
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
unsigned int index;
g_cpuqueue = BLI_thread_queue_init();
- BLI_init_threads(&g_cputhreads, thread_execute_cpu, g_cpudevices.size());
+ BLI_threadpool_init(&g_cputhreads, thread_execute_cpu, g_cpudevices.size());
for (index = 0; index < g_cpudevices.size(); index++) {
Device *device = g_cpudevices[index];
- BLI_insert_thread(&g_cputhreads, device);
+ BLI_threadpool_insert(&g_cputhreads, device);
}
#ifdef COM_OPENCL_ENABLED
if (context.getHasActiveOpenCLDevices()) {
g_gpuqueue = BLI_thread_queue_init();
- BLI_init_threads(&g_gputhreads, thread_execute_gpu, g_gpudevices.size());
+ BLI_threadpool_init(&g_gputhreads, thread_execute_gpu, g_gpudevices.size());
for (index = 0; index < g_gpudevices.size(); index++) {
Device *device = g_gpudevices[index];
- BLI_insert_thread(&g_gputhreads, device);
+ BLI_threadpool_insert(&g_gputhreads, device);
}
g_openclActive = true;
}
@@ -172,13 +172,13 @@ void WorkScheduler::stop()
{
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
BLI_thread_queue_nowait(g_cpuqueue);
- BLI_end_threads(&g_cputhreads);
+ BLI_threadpool_end(&g_cputhreads);
BLI_thread_queue_free(g_cpuqueue);
g_cpuqueue = NULL;
#ifdef COM_OPENCL_ENABLED
if (g_openclActive) {
BLI_thread_queue_nowait(g_gpuqueue);
- BLI_end_threads(&g_gputhreads);
+ BLI_threadpool_end(&g_gputhreads);
BLI_thread_queue_free(g_gpuqueue);
g_gpuqueue = NULL;
}
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp
index 15ffff2fc90..fe13f3d60a2 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.cpp
+++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp
@@ -108,9 +108,9 @@ void CompositorOperation::deinitExecution()
re = NULL;
}
- BLI_lock_thread(LOCK_DRAW_IMAGE);
+ BLI_thread_lock(LOCK_DRAW_IMAGE);
BKE_image_signal(BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result"), NULL, IMA_SIGNAL_FREE);
- BLI_unlock_thread(LOCK_DRAW_IMAGE);
+ BLI_thread_unlock(LOCK_DRAW_IMAGE);
}
else {
if (this->m_outputBuffer) {
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp
index aa47d3427d0..42fe24120dc 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.cpp
+++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp
@@ -135,14 +135,14 @@ void ViewerOperation::initImage()
BKE_image_verify_viewer_views(this->m_rd, ima, this->m_imageUser);
}
- BLI_lock_thread(LOCK_DRAW_IMAGE);
+ BLI_thread_lock(LOCK_DRAW_IMAGE);
/* local changes to the original ImageUser */
iuser.multi_index = BKE_scene_multiview_view_id_get(this->m_rd, this->m_viewName);
ibuf = BKE_image_acquire_ibuf(ima, &iuser, &lock);
if (!ibuf) {
- BLI_unlock_thread(LOCK_DRAW_IMAGE);
+ BLI_thread_unlock(LOCK_DRAW_IMAGE);
return;
}
if (ibuf->x != (int)getWidth() || ibuf->y != (int)getHeight()) {
@@ -176,7 +176,7 @@ void ViewerOperation::initImage()
BKE_image_release_ibuf(this->m_image, this->m_ibuf, lock);
- BLI_unlock_thread(LOCK_DRAW_IMAGE);
+ BLI_thread_unlock(LOCK_DRAW_IMAGE);
}
void ViewerOperation::updateImage(rcti *rect)
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index 11d96da5786..9837fec2b1e 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -832,9 +832,9 @@ static int bake_image_exec(bContext *C, wmOperator *op)
RE_Database_Baking(bkr.re, bmain, scene, scene->lay, scene->r.bake_mode, (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT : NULL);
/* baking itself is threaded, cannot use test_break in threads */
- BLI_init_threads(&threads, do_bake_render, 1);
+ BLI_threadpool_init(&threads, do_bake_render, 1);
bkr.ready = 0;
- BLI_insert_thread(&threads, &bkr);
+ BLI_threadpool_insert(&threads, &bkr);
while (bkr.ready == 0) {
PIL_sleep_ms(50);
@@ -845,7 +845,7 @@ static int bake_image_exec(bContext *C, wmOperator *op)
if (!G.background)
BKE_blender_test_break();
}
- BLI_end_threads(&threads);
+ BLI_threadpool_end(&threads);
if (bkr.result == BAKE_RESULT_NO_OBJECTS)
BKE_report(op->reports, RPT_ERROR, "No valid images found to bake to");
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index d0da35aeb9d..58b4c0fe222 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -323,12 +323,12 @@ static int screen_render_exec(bContext *C, wmOperator *op)
RE_SetReports(re, op->reports);
- BLI_begin_threaded_malloc();
+ BLI_threaded_malloc_begin();
if (is_animation)
RE_BlenderAnim(re, mainp, scene, camera_override, lay_override, scene->r.sfra, scene->r.efra, scene->r.frame_step);
else
RE_BlenderFrame(re, mainp, scene, srl, camera_override, lay_override, scene->r.cfra, is_write_still);
- BLI_end_threaded_malloc();
+ BLI_threaded_malloc_end();
RE_SetReports(re, NULL);
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index c309b223a81..27bffd2376e 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -2692,7 +2692,7 @@ static void project_paint_face_init(
int face_seam_flag;
if (threaded)
- BLI_lock_thread(LOCK_CUSTOM1); /* Other threads could be modifying these vars */
+ BLI_thread_lock(LOCK_CUSTOM1); /* Other threads could be modifying these vars */
face_seam_flag = ps->faceSeamFlags[tri_index];
@@ -2709,7 +2709,7 @@ static void project_paint_face_init(
if ((face_seam_flag & (PROJ_FACE_SEAM1 | PROJ_FACE_SEAM2 | PROJ_FACE_SEAM3)) == 0) {
if (threaded)
- BLI_unlock_thread(LOCK_CUSTOM1); /* Other threads could be modifying these vars */
+ BLI_thread_unlock(LOCK_CUSTOM1); /* Other threads could be modifying these vars */
}
else {
@@ -2735,7 +2735,7 @@ static void project_paint_face_init(
/* ps->faceSeamUVs cant be modified when threading, now this is done we can unlock */
if (threaded)
- BLI_unlock_thread(LOCK_CUSTOM1); /* Other threads could be modifying these vars */
+ BLI_thread_unlock(LOCK_CUSTOM1); /* Other threads could be modifying these vars */
vCoSS[0] = ps->screenCoords[lt_vtri[0]];
vCoSS[1] = ps->screenCoords[lt_vtri[1]];
@@ -4133,7 +4133,7 @@ static bool project_bucket_iter_next(
const int diameter = 2 * ps->brush_size;
if (ps->thread_tot > 1)
- BLI_lock_thread(LOCK_CUSTOM1);
+ BLI_thread_lock(LOCK_CUSTOM1);
//printf("%d %d\n", ps->context_bucket_x, ps->context_bucket_y);
@@ -4150,7 +4150,7 @@ static bool project_bucket_iter_next(
ps->context_bucket_x++;
if (ps->thread_tot > 1)
- BLI_unlock_thread(LOCK_CUSTOM1);
+ BLI_thread_unlock(LOCK_CUSTOM1);
return 1;
}
@@ -4159,7 +4159,7 @@ static bool project_bucket_iter_next(
}
if (ps->thread_tot > 1)
- BLI_unlock_thread(LOCK_CUSTOM1);
+ BLI_thread_unlock(LOCK_CUSTOM1);
return 0;
}
@@ -4878,7 +4878,7 @@ static bool project_paint_op(void *state, const float lastpos[2], const float po
}
if (ps->thread_tot > 1)
- BLI_init_threads(&threads, do_projectpaint_thread, ps->thread_tot);
+ BLI_threadpool_init(&threads, do_projectpaint_thread, ps->thread_tot);
pool = BKE_image_pool_new();
@@ -4908,11 +4908,11 @@ static bool project_paint_op(void *state, const float lastpos[2], const float po
handles[a].pool = pool;
if (ps->thread_tot > 1)
- BLI_insert_thread(&threads, &handles[a]);
+ BLI_threadpool_insert(&threads, &handles[a]);
}
if (ps->thread_tot > 1) /* wait for everything to be done */
- BLI_end_threads(&threads);
+ BLI_threadpool_end(&threads);
else
do_projectpaint_thread(&handles[0]);
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 1b96d2fd5a0..d22ddd644f9 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -890,7 +890,7 @@ SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node,
SculptUndoNode *unode;
/* list is manipulated by multiple threads, so we lock */
- BLI_lock_thread(LOCK_CUSTOM1);
+ BLI_thread_lock(LOCK_CUSTOM1);
if (ss->bm ||
ELEM(type,
@@ -900,17 +900,17 @@ SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node,
/* Dynamic topology stores only one undo node per stroke,
* regardless of the number of PBVH nodes modified */
unode = sculpt_undo_bmesh_push(ob, node, type);
- BLI_unlock_thread(LOCK_CUSTOM1);
+ BLI_thread_unlock(LOCK_CUSTOM1);
return unode;
}
else if ((unode = sculpt_undo_get_node(node))) {
- BLI_unlock_thread(LOCK_CUSTOM1);
+ BLI_thread_unlock(LOCK_CUSTOM1);
return unode;
}
unode = sculpt_undo_alloc_node(ob, node, type);
- BLI_unlock_thread(LOCK_CUSTOM1);
+ BLI_thread_unlock(LOCK_CUSTOM1);
/* copy threaded, hopefully this is the performance critical part */
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 8cb23c9e021..4d4beb07f00 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -881,7 +881,7 @@ void draw_image_main(const bContext *C, ARegion *ar)
* other images are not modifying in such a way so they does not require
* lock (sergey)
*/
- BLI_lock_thread(LOCK_DRAW_IMAGE);
+ BLI_thread_lock(LOCK_DRAW_IMAGE);
}
if (show_stereo3d) {
@@ -942,7 +942,7 @@ void draw_image_main(const bContext *C, ARegion *ar)
#endif
if (show_viewer) {
- BLI_unlock_thread(LOCK_DRAW_IMAGE);
+ BLI_thread_unlock(LOCK_DRAW_IMAGE);
}
/* render info */
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 54adb121fe8..ba67eb4683f 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -765,14 +765,14 @@ static void image_main_region_draw(const bContext *C, ARegion *ar)
/* ED_space_image_get* will acquire image buffer which requires
* lock here by the same reason why lock is needed in draw_image_main
*/
- BLI_lock_thread(LOCK_DRAW_IMAGE);
+ BLI_thread_lock(LOCK_DRAW_IMAGE);
}
ED_space_image_get_size(sima, &width, &height);
ED_space_image_get_aspect(sima, &aspx, &aspy);
if (show_viewer)
- BLI_unlock_thread(LOCK_DRAW_IMAGE);
+ BLI_thread_unlock(LOCK_DRAW_IMAGE);
ED_mask_draw_region(mask, ar,
sima->mask_info.draw_flag,
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 6d22f958a2f..cdbb57c436a 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -3793,28 +3793,28 @@ static void view3d_stereo3d_setup(Scene *scene, View3D *v3d, ARegion *ar, const
data = (Camera *)v3d->camera->data;
shiftx = data->shiftx;
- BLI_lock_thread(LOCK_VIEW3D);
+ BLI_thread_lock(LOCK_VIEW3D);
data->shiftx = BKE_camera_multiview_shift_x(&scene->r, v3d->camera, viewname);
BKE_camera_multiview_view_matrix(&scene->r, v3d->camera, is_left, viewmat);
view3d_main_region_setup_view(scene, v3d, ar, viewmat, NULL, rect);
data->shiftx = shiftx;
- BLI_unlock_thread(LOCK_VIEW3D);
+ BLI_thread_unlock(LOCK_VIEW3D);
}
else { /* SCE_VIEWS_FORMAT_MULTIVIEW */
float viewmat[4][4];
Object *view_ob = v3d->camera;
Object *camera = BKE_camera_multiview_render(scene, v3d->camera, viewname);
- BLI_lock_thread(LOCK_VIEW3D);
+ BLI_thread_lock(LOCK_VIEW3D);
v3d->camera = camera;
BKE_camera_multiview_view_matrix(&scene->r, camera, false, viewmat);
view3d_main_region_setup_view(scene, v3d, ar, viewmat, NULL, rect);
v3d->camera = view_ob;
- BLI_unlock_thread(LOCK_VIEW3D);
+ BLI_thread_unlock(LOCK_VIEW3D);
}
}
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 61d57dee092..514f2f71bd7 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -1475,9 +1475,9 @@ static LinkNode *image_free_queue = NULL;
static void gpu_queue_image_for_free(Image *ima)
{
- BLI_lock_thread(LOCK_OPENGL);
+ BLI_thread_lock(LOCK_OPENGL);
BLI_linklist_prepend(&image_free_queue, ima);
- BLI_unlock_thread(LOCK_OPENGL);
+ BLI_thread_unlock(LOCK_OPENGL);
}
void GPU_free_unused_buffers(void)
@@ -1485,7 +1485,7 @@ void GPU_free_unused_buffers(void)
if (!BLI_thread_is_main())
return;
- BLI_lock_thread(LOCK_OPENGL);
+ BLI_thread_lock(LOCK_OPENGL);
/* images */
for (LinkNode *node = image_free_queue; node; node = node->next) {
@@ -1502,7 +1502,7 @@ void GPU_free_unused_buffers(void)
/* vbo buffers */
GPU_global_buffer_pool_free_unused();
- BLI_unlock_thread(LOCK_OPENGL);
+ BLI_thread_unlock(LOCK_OPENGL);
}
void GPU_free_image(Image *ima)
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index 863bce125c5..e28c8122006 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -2176,7 +2176,7 @@ unsigned char *IMB_display_buffer_acquire(ImBuf *ibuf, const ColorManagedViewSet
BLI_rcti_init(&ibuf->invalid_rect, 0, 0, 0, 0);
}
- BLI_lock_thread(LOCK_COLORMANAGE);
+ BLI_thread_lock(LOCK_COLORMANAGE);
/* ensure color management bit fields exists */
if (!ibuf->display_buffer_flags) {
@@ -2194,7 +2194,7 @@ unsigned char *IMB_display_buffer_acquire(ImBuf *ibuf, const ColorManagedViewSet
display_buffer = colormanage_cache_get(ibuf, &cache_view_settings, &cache_display_settings, cache_handle);
if (display_buffer) {
- BLI_unlock_thread(LOCK_COLORMANAGE);
+ BLI_thread_unlock(LOCK_COLORMANAGE);
return display_buffer;
}
@@ -2205,7 +2205,7 @@ unsigned char *IMB_display_buffer_acquire(ImBuf *ibuf, const ColorManagedViewSet
colormanage_cache_put(ibuf, &cache_view_settings, &cache_display_settings, display_buffer, cache_handle);
- BLI_unlock_thread(LOCK_COLORMANAGE);
+ BLI_thread_unlock(LOCK_COLORMANAGE);
return display_buffer;
}
@@ -2244,11 +2244,11 @@ void IMB_display_buffer_transform_apply(unsigned char *display_buffer, float *li
void IMB_display_buffer_release(void *cache_handle)
{
if (cache_handle) {
- BLI_lock_thread(LOCK_COLORMANAGE);
+ BLI_thread_lock(LOCK_COLORMANAGE);
colormanage_cache_handle_release(cache_handle);
- BLI_unlock_thread(LOCK_COLORMANAGE);
+ BLI_thread_unlock(LOCK_COLORMANAGE);
}
}
@@ -2964,7 +2964,7 @@ static void imb_partial_display_buffer_update_ex(ImBuf *ibuf,
view_flag = 1 << (cache_view_settings.view - 1);
display_index = cache_display_settings.display - 1;
- BLI_lock_thread(LOCK_COLORMANAGE);
+ BLI_thread_lock(LOCK_COLORMANAGE);
if ((ibuf->userflags & IB_DISPLAY_BUFFER_INVALID) == 0) {
display_buffer = colormanage_cache_get(ibuf,
@@ -2983,7 +2983,7 @@ static void imb_partial_display_buffer_update_ex(ImBuf *ibuf,
memset(ibuf->display_buffer_flags, 0, global_tot_display * sizeof(unsigned int));
ibuf->display_buffer_flags[display_index] |= view_flag;
- BLI_unlock_thread(LOCK_COLORMANAGE);
+ BLI_thread_unlock(LOCK_COLORMANAGE);
}
if (display_buffer == NULL) {
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index 3629332a4ac..3c587684641 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -652,7 +652,7 @@ static struct IMBThumbLocks {
void IMB_thumb_locks_acquire(void)
{
- BLI_lock_thread(LOCK_IMAGE);
+ BLI_thread_lock(LOCK_IMAGE);
if (thumb_locks.lock_counter == 0) {
BLI_assert(thumb_locks.locked_paths == NULL);
@@ -663,12 +663,12 @@ void IMB_thumb_locks_acquire(void)
BLI_assert(thumb_locks.locked_paths != NULL);
BLI_assert(thumb_locks.lock_counter > 0);
- BLI_unlock_thread(LOCK_IMAGE);
+ BLI_thread_unlock(LOCK_IMAGE);
}
void IMB_thumb_locks_release(void)
{
- BLI_lock_thread(LOCK_IMAGE);
+ BLI_thread_lock(LOCK_IMAGE);
BLI_assert((thumb_locks.locked_paths != NULL) && (thumb_locks.lock_counter > 0));
thumb_locks.lock_counter--;
@@ -678,14 +678,14 @@ void IMB_thumb_locks_release(void)
BLI_condition_end(&thumb_locks.cond);
}
- BLI_unlock_thread(LOCK_IMAGE);
+ BLI_thread_unlock(LOCK_IMAGE);
}
void IMB_thumb_path_lock(const char *path)
{
void *key = BLI_strdup(path);
- BLI_lock_thread(LOCK_IMAGE);
+ BLI_thread_lock(LOCK_IMAGE);
BLI_assert((thumb_locks.locked_paths != NULL) && (thumb_locks.lock_counter > 0));
if (thumb_locks.locked_paths) {
@@ -694,14 +694,14 @@ void IMB_thumb_path_lock(const char *path)
}
}
- BLI_unlock_thread(LOCK_IMAGE);
+ BLI_thread_unlock(LOCK_IMAGE);
}
void IMB_thumb_path_unlock(const char *path)
{
const void *key = path;
- BLI_lock_thread(LOCK_IMAGE);
+ BLI_thread_lock(LOCK_IMAGE);
BLI_assert((thumb_locks.locked_paths != NULL) && (thumb_locks.lock_counter > 0));
if (thumb_locks.locked_paths) {
@@ -711,5 +711,5 @@ void IMB_thumb_path_unlock(const char *path)
BLI_condition_notify_all(&thumb_locks.cond);
}
- BLI_unlock_thread(LOCK_IMAGE);
+ BLI_thread_unlock(LOCK_IMAGE);
}
diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c
index 8fa074c5cb7..ce47ecd9a23 100644
--- a/source/blender/nodes/shader/node_shader_tree.c
+++ b/source/blender/nodes/shader/node_shader_tree.c
@@ -616,10 +616,10 @@ bool ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr)
/* ensure execdata is only initialized once */
if (!exec) {
- BLI_lock_thread(LOCK_NODES);
+ BLI_thread_lock(LOCK_NODES);
if (!ntree->execdata)
ntree->execdata = ntreeShaderBeginExecTree(ntree);
- BLI_unlock_thread(LOCK_NODES);
+ BLI_thread_unlock(LOCK_NODES);
exec = ntree->execdata;
}
diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c
index 714665c303b..bc48802a7ca 100644
--- a/source/blender/nodes/texture/node_texture_tree.c
+++ b/source/blender/nodes/texture/node_texture_tree.c
@@ -345,10 +345,10 @@ int ntreeTexExecTree(
/* ensure execdata is only initialized once */
if (!exec) {
- BLI_lock_thread(LOCK_NODES);
+ BLI_thread_lock(LOCK_NODES);
if (!nodes->execdata)
ntreeTexBeginExecTree(nodes);
- BLI_unlock_thread(LOCK_NODES);
+ BLI_thread_unlock(LOCK_NODES);
exec = nodes->execdata;
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c
index 8e9821c0fcb..69c8f4b7262 100644
--- a/source/blender/nodes/texture/nodes/node_texture_image.c
+++ b/source/blender/nodes/texture/nodes/node_texture_image.c
@@ -64,10 +64,10 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(i
if ( (!xsize) || (!ysize) ) return;
if (!ibuf->rect_float) {
- BLI_lock_thread(LOCK_IMAGE);
+ BLI_thread_lock(LOCK_IMAGE);
if (!ibuf->rect_float)
IMB_float_from_rect(ibuf);
- BLI_unlock_thread(LOCK_IMAGE);
+ BLI_thread_unlock(LOCK_IMAGE);
}
while (px < 0) px += ibuf->x;
diff --git a/source/blender/render/intern/source/bake.c b/source/blender/render/intern/source/bake.c
index 31e461b4536..b5a37d1d42b 100644
--- a/source/blender/render/intern/source/bake.c
+++ b/source/blender/render/intern/source/bake.c
@@ -609,7 +609,7 @@ static int get_next_bake_face(BakeShade *bs)
return 0;
}
- BLI_lock_thread(LOCK_CUSTOM1);
+ BLI_thread_lock(LOCK_CUSTOM1);
for (; obi; obi = obi->next, v = 0) {
obr = obi->obr;
@@ -724,13 +724,13 @@ static int get_next_bake_face(BakeShade *bs)
bs->vlr = vlr;
bs->vdone++; /* only for error message if nothing was rendered */
v++;
- BLI_unlock_thread(LOCK_CUSTOM1);
+ BLI_thread_unlock(LOCK_CUSTOM1);
return 1;
}
}
}
- BLI_unlock_thread(LOCK_CUSTOM1);
+ BLI_thread_unlock(LOCK_CUSTOM1);
return 0;
}
@@ -845,7 +845,7 @@ static void shade_tface(BakeShade *bs)
if (bs->use_mask || bs->use_displacement_buffer) {
BakeImBufuserData *userdata = bs->ibuf->userdata;
if (userdata == NULL) {
- BLI_lock_thread(LOCK_CUSTOM1);
+ BLI_thread_lock(LOCK_CUSTOM1);
userdata = bs->ibuf->userdata;
if (userdata == NULL) /* since the thread was locked, its possible another thread alloced the value */
userdata = MEM_callocN(sizeof(BakeImBufuserData), "BakeImBufuserData");
@@ -864,7 +864,7 @@ static void shade_tface(BakeShade *bs)
bs->ibuf->userdata = userdata;
- BLI_unlock_thread(LOCK_CUSTOM1);
+ BLI_thread_unlock(LOCK_CUSTOM1);
}
bs->rect_mask = userdata->mask_buffer;
@@ -1040,7 +1040,7 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
BKE_main_id_tag_listbase(&G.main->mesh, LIB_TAG_DOIT, false);
}
- BLI_init_threads(&threads, do_bake_thread, re->r.threads);
+ BLI_threadpool_init(&threads, do_bake_thread, re->r.threads);
handles = MEM_callocN(sizeof(BakeShade) * re->r.threads, "BakeShade");
@@ -1077,7 +1077,7 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
handles[a].displacement_min = FLT_MAX;
handles[a].displacement_max = -FLT_MAX;
- BLI_insert_thread(&threads, &handles[a]);
+ BLI_threadpool_insert(&threads, &handles[a]);
}
/* wait for everything to be done */
@@ -1151,7 +1151,7 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
MEM_freeN(handles);
- BLI_end_threads(&threads);
+ BLI_threadpool_end(&threads);
if (vdone == 0) {
result = BAKE_RESULT_NO_OBJECTS;
diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c
index 156b4215992..40b249192f9 100644
--- a/source/blender/render/intern/source/envmap.c
+++ b/source/blender/render/intern/source/envmap.c
@@ -70,7 +70,7 @@ static void envmap_split_ima(EnvMap *env, ImBuf *ibuf)
int dx, part;
/* after lock we test cube[1], if set the other thread has done it fine */
- BLI_lock_thread(LOCK_IMAGE);
+ BLI_thread_lock(LOCK_IMAGE);
if (env->cube[1] == NULL) {
BKE_texture_envmap_free_data(env);
@@ -118,7 +118,7 @@ static void envmap_split_ima(EnvMap *env, ImBuf *ibuf)
}
}
}
- BLI_unlock_thread(LOCK_IMAGE);
+ BLI_thread_unlock(LOCK_IMAGE);
}
/* ------------------------------------------------------------------------- */
diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c
index 8764abf9674..6277f1ff727 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -144,7 +144,7 @@ RenderEngine *RE_engine_create_ex(RenderEngineType *type, bool use_for_viewport)
if (use_for_viewport) {
engine->flag |= RE_ENGINE_USED_FOR_VIEWPORT;
- BLI_begin_threaded_malloc();
+ BLI_threaded_malloc_begin();
}
return engine;
@@ -159,7 +159,7 @@ void RE_engine_free(RenderEngine *engine)
#endif
if (engine->flag & RE_ENGINE_USED_FOR_VIEWPORT) {
- BLI_end_threaded_malloc();
+ BLI_threaded_malloc_end();
}
MEM_freeN(engine);
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index ae02cf56b88..6e5d10fcc84 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -890,18 +890,18 @@ static void image_mipmap_test(Tex *tex, ImBuf *ibuf)
if ((ibuf->flags & IB_fields) == 0) {
if (ibuf->mipmap[0] && (ibuf->userflags & IB_MIPMAP_INVALID)) {
- BLI_lock_thread(LOCK_IMAGE);
+ BLI_thread_lock(LOCK_IMAGE);
if (ibuf->userflags & IB_MIPMAP_INVALID) {
IMB_remakemipmap(ibuf, tex->imaflag & TEX_GAUSS_MIP);
ibuf->userflags &= ~IB_MIPMAP_INVALID;
}
- BLI_unlock_thread(LOCK_IMAGE);
+ BLI_thread_unlock(LOCK_IMAGE);
}
if (ibuf->mipmap[0] == NULL) {
- BLI_lock_thread(LOCK_IMAGE);
+ BLI_thread_lock(LOCK_IMAGE);
if (ibuf->mipmap[0] == NULL)
IMB_makemipmap(ibuf, tex->imaflag & TEX_GAUSS_MIP);
- BLI_unlock_thread(LOCK_IMAGE);
+ BLI_thread_unlock(LOCK_IMAGE);
}
/* if no mipmap could be made, fall back on non-mipmap render */
if (ibuf->mipmap[0] == NULL) {
diff --git a/source/blender/render/intern/source/multires_bake.c b/source/blender/render/intern/source/multires_bake.c
index fba5836ac32..9e0685d55f1 100644
--- a/source/blender/render/intern/source/multires_bake.c
+++ b/source/blender/render/intern/source/multires_bake.c
@@ -466,7 +466,7 @@ static void do_multires_bake(MultiresBakeRender *bkr, Image *ima, bool require_t
bake_data = initBakeData(bkr, ima);
if (tot_thread > 1)
- BLI_init_threads(&threads, do_multires_bake_thread, tot_thread);
+ BLI_threadpool_init(&threads, do_multires_bake_thread, tot_thread);
handles = MEM_callocN(tot_thread * sizeof(MultiresBakeThread), "do_multires_bake handles");
@@ -509,12 +509,12 @@ static void do_multires_bake(MultiresBakeRender *bkr, Image *ima, bool require_t
init_bake_rast(&handle->bake_rast, ibuf, &handle->data, flush_pixel, bkr->do_update);
if (tot_thread > 1)
- BLI_insert_thread(&threads, handle);
+ BLI_threadpool_insert(&threads, handle);
}
/* run threads */
if (tot_thread > 1)
- BLI_end_threads(&threads);
+ BLI_threadpool_end(&threads);
else
do_multires_bake_thread(&handles[0]);
diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c
index cd93898d846..42200a8278c 100644
--- a/source/blender/render/intern/source/occlusion.c
+++ b/source/blender/render/intern/source/occlusion.c
@@ -553,7 +553,7 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
occ_build_8_split(tree, begin, end, offset, count);
if (depth == 1 && tree->dothreadedbuild)
- BLI_init_threads(&threads, exec_occ_build, tree->totbuildthread);
+ BLI_threadpool_init(&threads, exec_occ_build, tree->totbuildthread);
for (b = 0; b < TOTCHILD; b++) {
if (count[b] == 0) {
@@ -566,7 +566,7 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
}
else {
if (tree->dothreadedbuild)
- BLI_lock_thread(LOCK_CUSTOM1);
+ BLI_thread_lock(LOCK_CUSTOM1);
child = BLI_memarena_alloc(tree->arena, sizeof(OccNode));
node->child[b].node = child;
@@ -576,7 +576,7 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
tree->maxdepth = depth + 1;
if (tree->dothreadedbuild)
- BLI_unlock_thread(LOCK_CUSTOM1);
+ BLI_thread_unlock(LOCK_CUSTOM1);
if (depth == 1 && tree->dothreadedbuild) {
othreads[totthread].tree = tree;
@@ -584,7 +584,7 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
othreads[totthread].begin = offset[b];
othreads[totthread].end = offset[b] + count[b];
othreads[totthread].depth = depth + 1;
- BLI_insert_thread(&threads, &othreads[totthread]);
+ BLI_threadpool_insert(&threads, &othreads[totthread]);
totthread++;
}
else
@@ -593,7 +593,7 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
}
if (depth == 1 && tree->dothreadedbuild)
- BLI_end_threads(&threads);
+ BLI_threadpool_end(&threads);
}
/* combine area, position and sh */
@@ -1313,12 +1313,12 @@ void make_occ_tree(Render *re)
exec_strandsurface_sample(&othreads[0]);
}
else {
- BLI_init_threads(&threads, exec_strandsurface_sample, totthread);
+ BLI_threadpool_init(&threads, exec_strandsurface_sample, totthread);
for (a = 0; a < totthread; a++)
- BLI_insert_thread(&threads, &othreads[a]);
+ BLI_threadpool_insert(&threads, &othreads[a]);
- BLI_end_threads(&threads);
+ BLI_threadpool_end(&threads);
}
for (a = 0; a < mesh->totface; a++) {
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 6ed2534f152..7cab5f43aca 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -1407,7 +1407,7 @@ static void threaded_tile_processor(Render *re)
BLI_thread_queue_nowait(workqueue);
/* start all threads */
- BLI_init_threads(&threads, do_render_thread, re->r.threads);
+ BLI_threadpool_init(&threads, do_render_thread, re->r.threads);
for (a = 0; a < re->r.threads; a++) {
thread[a].workqueue = workqueue;
@@ -1423,7 +1423,7 @@ static void threaded_tile_processor(Render *re)
thread[a].duh = NULL;
}
- BLI_insert_thread(&threads, &thread[a]);
+ BLI_threadpool_insert(&threads, &thread[a]);
}
/* wait for results to come back */
@@ -1467,7 +1467,7 @@ static void threaded_tile_processor(Render *re)
}
}
- BLI_end_threads(&threads);
+ BLI_threadpool_end(&threads);
if ((g_break=re->test_break(re->tbh)))
break;
diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c
index a3eeed2b144..542c737348b 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -1041,7 +1041,7 @@ static void save_render_result_tile(RenderResult *rr, RenderResult *rrpart, cons
RenderPass *rpassp;
int offs, partx, party;
- BLI_lock_thread(LOCK_IMAGE);
+ BLI_thread_lock(LOCK_IMAGE);
for (rlp = rrpart->layers.first; rlp; rlp = rlp->next) {
rl = RE_GetRenderLayer(rr, rlp->name);
@@ -1090,7 +1090,7 @@ static void save_render_result_tile(RenderResult *rr, RenderResult *rrpart, cons
IMB_exrtile_write_channels(rl->exrhandle, partx, party, 0, viewname, false);
}
- BLI_unlock_thread(LOCK_IMAGE);
+ BLI_thread_unlock(LOCK_IMAGE);
}
void render_result_save_empty_result_tiles(Render *re)
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index 4241dff96de..e66dd86a75a 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -3675,7 +3675,7 @@ void render_realtime_texture(ShadeInput *shi, Image *ima)
if (R.r.scemode & R_NO_TEX) return;
if (firsttime) {
- BLI_lock_thread(LOCK_IMAGE);
+ BLI_thread_lock(LOCK_IMAGE);
if (firsttime) {
const int num_threads = BLI_system_thread_count();
for (a = 0; a < num_threads; a++) {
@@ -3686,7 +3686,7 @@ void render_realtime_texture(ShadeInput *shi, Image *ima)
firsttime= 0;
}
- BLI_unlock_thread(LOCK_IMAGE);
+ BLI_thread_unlock(LOCK_IMAGE);
}
tex= &imatex[shi->thread];
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index 6dd7e2c152d..7c62bf4cd94 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -787,10 +787,10 @@ void makeshadowbuf(Render *re, LampRen *lar)
shb->totbuf= lar->buffers;
/* jitter, weights - not threadsafe! */
- BLI_lock_thread(LOCK_CUSTOM1);
+ BLI_thread_lock(LOCK_CUSTOM1);
shb->jit= give_jitter_tab(get_render_shadow_samples(&re->r, shb->samp));
make_jitter_weight_tab(re, shb, lar->filtertype);
- BLI_unlock_thread(LOCK_CUSTOM1);
+ BLI_thread_unlock(LOCK_CUSTOM1);
if (shb->totbuf==4) jitbuf= give_jitter_tab(2);
else if (shb->totbuf==9) jitbuf= give_jitter_tab(3);
@@ -814,21 +814,21 @@ static void *do_shadow_thread(void *re_v)
LampRen *lar;
do {
- BLI_lock_thread(LOCK_CUSTOM1);
+ BLI_thread_lock(LOCK_CUSTOM1);
for (lar=re->lampren.first; lar; lar=lar->next) {
if (lar->shb && !lar->thread_assigned) {
lar->thread_assigned= 1;
break;
}
}
- BLI_unlock_thread(LOCK_CUSTOM1);
+ BLI_thread_unlock(LOCK_CUSTOM1);
/* if type is irregular, this only sets the perspective matrix and autoclips */
if (lar) {
makeshadowbuf(re, lar);
- BLI_lock_thread(LOCK_CUSTOM1);
+ BLI_thread_lock(LOCK_CUSTOM1);
lar->thread_ready= 1;
- BLI_unlock_thread(LOCK_CUSTOM1);
+ BLI_thread_unlock(LOCK_CUSTOM1);
}
} while (lar && !re->test_break(re->tbh));
@@ -878,10 +878,10 @@ void threaded_makeshadowbufs(Render *re)
lar->thread_ready= 0;
}
- BLI_init_threads(&threads, do_shadow_thread, totthread);
+ BLI_threadpool_init(&threads, do_shadow_thread, totthread);
for (a=0; a<totthread; a++)
- BLI_insert_thread(&threads, re);
+ BLI_threadpool_insert(&threads, re);
/* keep rendering as long as there are shadow buffers not ready */
do {
@@ -890,14 +890,14 @@ void threaded_makeshadowbufs(Render *re)
PIL_sleep_ms(50);
- BLI_lock_thread(LOCK_CUSTOM1);
+ BLI_thread_lock(LOCK_CUSTOM1);
for (lar=re->lampren.first; lar; lar= lar->next)
if (lar->shb && !lar->thread_ready)
break;
- BLI_unlock_thread(LOCK_CUSTOM1);
+ BLI_thread_unlock(LOCK_CUSTOM1);
} while (lar);
- BLI_end_threads(&threads);
+ BLI_threadpool_end(&threads);
/* unset threadsafety */
re->test_break= test_break;
diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c
index 26ca3ad50e0..c29da9b17c6 100644
--- a/source/blender/render/intern/source/sss.c
+++ b/source/blender/render/intern/source/sss.c
@@ -973,9 +973,9 @@ void sss_add_points(Render *re, float (*co)[3], float (*color)[3], float *area,
p->area= area;
p->totpoint= totpoint;
- BLI_lock_thread(LOCK_CUSTOM1);
+ BLI_thread_lock(LOCK_CUSTOM1);
BLI_addtail(re->sss_points, p);
- BLI_unlock_thread(LOCK_CUSTOM1);
+ BLI_thread_unlock(LOCK_CUSTOM1);
}
}
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index 528b9e2b3d9..f9fe787ed2d 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -418,8 +418,8 @@ void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
// printf("job started: %s\n", wm_job->name);
- BLI_init_threads(&wm_job->threads, do_job_thread, 1);
- BLI_insert_thread(&wm_job->threads, wm_job);
+ BLI_threadpool_init(&wm_job->threads, do_job_thread, 1);
+ BLI_threadpool_insert(&wm_job->threads, wm_job);
}
/* restarted job has timer already */
@@ -450,7 +450,7 @@ static void wm_jobs_kill_job(wmWindowManager *wm, wmJob *wm_job)
wm_job->stop = true;
WM_job_main_thread_lock_release(wm_job);
- BLI_end_threads(&wm_job->threads);
+ BLI_threadpool_end(&wm_job->threads);
WM_job_main_thread_lock_acquire(wm_job);
if (wm_job->endjob)
@@ -601,7 +601,7 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
wm_job->running = false;
WM_job_main_thread_lock_release(wm_job);
- BLI_end_threads(&wm_job->threads);
+ BLI_threadpool_end(&wm_job->threads);
WM_job_main_thread_lock_acquire(wm_job);
if (wm_job->endnote)
diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index a9da1e8c794..c9cdc1c9ccf 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -1376,7 +1376,7 @@ static int arg_handle_render_frame(int argc, const char **argv, void *data)
}
re = RE_NewSceneRender(scene);
- BLI_begin_threaded_malloc();
+ BLI_threaded_malloc_begin();
BKE_reports_init(&reports, RPT_STORE);
RE_SetReports(re, &reports);
@@ -1393,7 +1393,7 @@ static int arg_handle_render_frame(int argc, const char **argv, void *data)
}
RE_SetReports(re, NULL);
BKE_reports_clear(&reports);
- BLI_end_threaded_malloc();
+ BLI_threaded_malloc_end();
MEM_freeN(frame_range_arr);
return 1;
}
@@ -1419,13 +1419,13 @@ static int arg_handle_render_animation(int UNUSED(argc), const char **UNUSED(arg
Main *bmain = CTX_data_main(C);
Render *re = RE_NewSceneRender(scene);
ReportList reports;
- BLI_begin_threaded_malloc();
+ BLI_threaded_malloc_begin();
BKE_reports_init(&reports, RPT_STORE);
RE_SetReports(re, &reports);
RE_BlenderAnim(re, bmain, scene, NULL, scene->lay, scene->r.sfra, scene->r.efra, scene->r.frame_step);
RE_SetReports(re, NULL);
BKE_reports_clear(&reports);
- BLI_end_threaded_malloc();
+ BLI_threaded_malloc_end();
}
else {
printf("\nError: no blend loaded. cannot use '-a'.\n");
diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
index 083e9e28502..10196804656 100644
--- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp
+++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
@@ -467,8 +467,8 @@ bool VideoFFmpeg::startCache()
CachePacket *packet = new CachePacket();
BLI_addtail(&m_packetCacheFree, packet);
}
- BLI_init_threads(&m_thread, cacheThread, 1);
- BLI_insert_thread(&m_thread, this);
+ BLI_threadpool_init(&m_thread, cacheThread, 1);
+ BLI_threadpool_insert(&m_thread, this);
m_cacheStarted = true;
}
return m_cacheStarted;
@@ -479,7 +479,7 @@ void VideoFFmpeg::stopCache()
if (m_cacheStarted)
{
m_stopThread = true;
- BLI_end_threads(&m_thread);
+ BLI_threadpool_end(&m_thread);
// now delete the cache
CacheFrame *frame;
CachePacket *packet;