From 2aef87bfae4a6a91f626780767aab68b7791c9d4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 16 Feb 2018 01:13:46 +1100 Subject: Cleanup: rename BLI_thread.h API - Use BLI_threadpool_ prefix for (deprecated) thread/listbase API. - Use BLI_thread as prefix for other functions. See P614 to apply instead of manually resolving conflicts. --- source/blender/blenkernel/intern/dynamicpaint.c | 4 +-- source/blender/blenkernel/intern/image.c | 16 ++++++------ source/blender/blenkernel/intern/movieclip.c | 20 +++++++-------- source/blender/blenkernel/intern/ocean.c | 8 +++--- source/blender/blenkernel/intern/smoke.c | 4 +-- source/blender/blenkernel/intern/softbody.c | 12 ++++----- source/blender/blenkernel/intern/tracking_util.c | 4 +-- source/blender/blenlib/BLI_threads.h | 22 ++++++++-------- source/blender/blenlib/intern/task.c | 4 +-- source/blender/blenlib/intern/threads.c | 30 +++++++++++----------- .../compositor/intern/COM_WorkScheduler.cpp | 12 ++++----- .../operations/COM_CompositorOperation.cpp | 4 +-- .../compositor/operations/COM_ViewerOperation.cpp | 6 ++--- source/blender/editors/object/object_bake.c | 6 ++--- source/blender/editors/render/render_internal.c | 4 +-- .../editors/sculpt_paint/paint_image_proj.c | 18 ++++++------- source/blender/editors/sculpt_paint/sculpt_undo.c | 8 +++--- source/blender/editors/space_image/image_draw.c | 4 +-- source/blender/editors/space_image/space_image.c | 4 +-- source/blender/editors/space_view3d/view3d_draw.c | 8 +++--- source/blender/gpu/intern/gpu_draw.c | 8 +++--- source/blender/imbuf/intern/colormanagement.c | 14 +++++----- source/blender/imbuf/intern/thumbs.c | 16 ++++++------ source/blender/nodes/shader/node_shader_tree.c | 4 +-- source/blender/nodes/texture/node_texture_tree.c | 4 +-- .../nodes/texture/nodes/node_texture_image.c | 4 +-- source/blender/render/intern/source/bake.c | 16 ++++++------ source/blender/render/intern/source/envmap.c | 4 +-- .../blender/render/intern/source/external_engine.c | 4 +-- source/blender/render/intern/source/imagetexture.c | 8 +++--- .../blender/render/intern/source/multires_bake.c | 6 ++--- source/blender/render/intern/source/occlusion.c | 16 ++++++------ source/blender/render/intern/source/pipeline.c | 6 ++--- .../blender/render/intern/source/render_result.c | 4 +-- .../blender/render/intern/source/render_texture.c | 4 +-- source/blender/render/intern/source/shadbuf.c | 22 ++++++++-------- source/blender/render/intern/source/sss.c | 4 +-- source/blender/windowmanager/intern/wm_jobs.c | 8 +++--- source/creator/creator_args.c | 8 +++--- source/gameengine/VideoTexture/VideoFFmpeg.cpp | 6 ++--- 40 files changed, 182 insertions(+), 182 deletions(-) (limited to 'source') 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 1) { - BLI_init_threads(&threads, exec_softbody_calc_forces, totthread); + BLI_threadpool_init(&threads, exec_softbody_calc_forces, totthread); for (i=0; im_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; alampren.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; -- cgit v1.2.3