diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-02-15 17:13:46 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-02-15 17:13:46 +0300 |
commit | 2aef87bfae4a6a91f626780767aab68b7791c9d4 (patch) | |
tree | 8c920050c424fd30fc649ad5b9a374b517f2ebad /source/blender/blenkernel | |
parent | ccdacf1c9b31b15e188aa9e9adb044ffd0ca0da4 (diff) |
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.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/dynamicpaint.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 16 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 20 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/ocean.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/smoke.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/softbody.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/tracking_util.c | 4 |
7 files changed, 34 insertions, 34 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. */ |