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/editors/object/object_bake.c | 6 +++--- source/blender/editors/render/render_internal.c | 4 ++-- source/blender/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 ++++---- 7 files changed, 26 insertions(+), 26 deletions(-) (limited to 'source/blender/editors') 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); } } -- cgit v1.2.3