|
Blender
V2.93
|
#include <cerrno>#include <cstdlib>#include <cstring>#include "MEM_guardedalloc.h"#include "BLI_gsqueue.h"#include "BLI_listbase.h"#include "BLI_system.h"#include "BLI_task.h"#include "BLI_threads.h"#include "PIL_time.h"#include <sys/time.h>#include <unistd.h>#include "atomic_ops.h"#include "numaapi.h"Go to the source code of this file.
Classes | |
| struct | ThreadSlot |
| struct | TicketMutex |
| struct | ThreadQueue |
Macros | |
| #define | RE_MAX_THREAD BLENDER_MAX_THREADS |
Variables | |
| static pthread_mutex_t | _image_lock = PTHREAD_MUTEX_INITIALIZER |
| static pthread_mutex_t | _image_draw_lock = PTHREAD_MUTEX_INITIALIZER |
| static pthread_mutex_t | _viewer_lock = PTHREAD_MUTEX_INITIALIZER |
| static pthread_mutex_t | _custom1_lock = PTHREAD_MUTEX_INITIALIZER |
| static pthread_mutex_t | _nodes_lock = PTHREAD_MUTEX_INITIALIZER |
| static pthread_mutex_t | _movieclip_lock = PTHREAD_MUTEX_INITIALIZER |
| static pthread_mutex_t | _colormanage_lock = PTHREAD_MUTEX_INITIALIZER |
| static pthread_mutex_t | _fftw_lock = PTHREAD_MUTEX_INITIALIZER |
| static pthread_mutex_t | _view3d_lock = PTHREAD_MUTEX_INITIALIZER |
| static pthread_t | mainid |
| static bool | is_numa_available = false |
| static unsigned int | thread_levels = 0 |
| static int | num_threads_override = 0 |
| #define RE_MAX_THREAD BLENDER_MAX_THREADS |
Definition at line 133 of file threads.cc.
| int BLI_available_threads | ( | ListBase * | threadbase | ) |
Definition at line 193 of file threads.cc.
References LISTBASE_FOREACH.
Referenced by background_task_pool_run().
| void BLI_condition_end | ( | ThreadCondition * | cond | ) |
Definition at line 627 of file threads.cc.
Referenced by IMB_thumb_locks_release(), screen_opengl_render_end(), and seq_prefetch_free().
| void BLI_condition_init | ( | ThreadCondition * | cond | ) |
Definition at line 602 of file threads.cc.
Referenced by IMB_thumb_locks_acquire(), screen_opengl_render_init(), and seq_prefetch_start_ex().
| void BLI_condition_notify_all | ( | ThreadCondition * | cond | ) |
Definition at line 622 of file threads.cc.
Referenced by IMB_thumb_path_unlock(), and write_result_func().
| void BLI_condition_notify_one | ( | ThreadCondition * | cond | ) |
Definition at line 617 of file threads.cc.
Referenced by seq_prefetch_resume(), and SEQ_prefetch_stop().
| void BLI_condition_wait | ( | ThreadCondition * | cond, |
| ThreadMutex * | mutex | ||
| ) |
Definition at line 607 of file threads.cc.
References mutex.
Referenced by schedule_write_result(), screen_opengl_render_end(), and seq_prefetch_do_suspend().
| void BLI_condition_wait_global_mutex | ( | ThreadCondition * | cond, |
| const int | type | ||
| ) |
Definition at line 612 of file threads.cc.
References global_mutex_from_type(), and type.
Referenced by IMB_thumb_path_lock().
| ThreadMutex* BLI_mutex_alloc | ( | void | ) |
Definition at line 421 of file threads.cc.
References BLI_mutex_init(), MEM_callocN, and mutex.
Referenced by BKE_images_init(), EEVEE_lightbake_job_create(), EEVEE_lightbake_job_data_alloc(), and sequencer_preview_add_sound().
| void BLI_mutex_end | ( | ThreadMutex * | mutex | ) |
Definition at line 416 of file threads.cc.
References mutex.
Referenced by BKE_mesh_runtime_clear_cache(), BLI_mutex_free(), BLI_spin_end(), BLI_task_pool_free(), bvhcache_free(), ccgDM_release(), COM_deinitialize(), blender::compositor::NodeOperation::deinitMutex(), drw_deferred_shader_compilation_free(), filelist_readjob_free(), gpu_batch_presets_exit(), imb_tile_cache_exit(), RE_engine_free(), screen_opengl_render_end(), seq_cache_destruct(), and seq_prefetch_free().
| void BLI_mutex_free | ( | ThreadMutex * | mutex | ) |
Definition at line 428 of file threads.cc.
References BLI_mutex_end(), MEM_freeN, and mutex.
Referenced by BKE_images_exit(), EEVEE_lightbake_job_data_free(), and free_preview_job().
| void BLI_mutex_init | ( | ThreadMutex * | mutex | ) |
Definition at line 396 of file threads.cc.
References mutex.
Referenced by BKE_mesh_runtime_reset(), BKE_mesh_runtime_reset_on_copy(), BLI_mutex_alloc(), BLI_spin_init(), bvhcache_init(), COM_execute(), drw_deferred_shader_add(), filelist_readjob_start(), getCCGDerivedMesh(), gpu_batch_presets_init(), imb_tile_cache_init(), IMB_tile_cache_params(), blender::compositor::NodeOperation::initMutex(), RE_engine_create(), screen_opengl_render_init(), seq_cache_create(), seq_disk_cache_create(), seq_prefetch_start_ex(), and task_pool_create_ex().
| void BLI_mutex_lock | ( | ThreadMutex * | mutex | ) |
Definition at line 401 of file threads.cc.
References mutex.
Referenced by BKE_collection_object_cache_get(), BKE_collection_object_cache_instanced_get(), BKE_image_acquire_ibuf(), BKE_image_ensure_viewer_views(), BKE_image_file_format_set(), BKE_image_free_anim_ibufs(), BKE_image_free_buffers_ex(), BKE_image_get_first_ibuf(), BKE_image_get_ibuf_with_name(), BKE_image_has_ibuf(), BKE_image_has_loaded_ibuf(), BKE_image_is_dirty_writable(), BKE_image_merge(), BKE_image_pool_acquire_ibuf(), BKE_image_pool_free(), BKE_image_release_ibuf(), BKE_image_signal(), BKE_mesh_runtime_looptri_ensure(), BKE_mesh_wrapper_ensure_mdata(), BKE_object_preview_geometry_set_add(), BKE_object_select_update(), BLI_spin_lock(), bvhcache_find(), ccgDM_copyFinalLoopArray(), colorspace_from_scene_linear_cpu_processor(), colorspace_to_scene_linear_cpu_processor(), COM_deinitialize(), COM_execute(), display_from_scene_linear_processor(), display_to_scene_linear_processor(), do_moviecache_put(), drw_deferred_shader_compilation_exec(), DRW_deferred_shader_remove(), eevee_lightbake_delete_resources(), EEVEE_lightbake_job_create(), evaluate_driver_python(), filelist_readjob_do(), filelist_readjob_startjob(), filelist_readjob_update(), blender::compositor::DenoiseOperation::generateDenoise(), give_parvert(), gpu_batch_presets_register(), gpu_batch_presets_unregister(), gpu_free_unused_buffers(), image_free_gpu(), image_mem_size(), IMB_colormanagement_color_picking_to_scene_linear_v3(), IMB_colormanagement_scene_linear_to_color_picking_v3(), imb_global_cache_get_tile(), IMB_moviecache_get(), IMB_moviecache_put_if_possible(), imb_tile_cache_tile_free(), IMB_tiles_to_rect(), blender::compositor::NodeOperation::lockMutex(), mesh_calc_modifiers(), preview_startjob(), RE_engine_update_render_passes(), RE_point_density_cache(), RE_point_density_sample(), schedule_write_result(), screen_opengl_render_end(), seq_cache_create(), seq_cache_get(), seq_cache_lock(), seq_cache_put(), seq_disk_cache_create(), seq_disk_cache_enforce_limits(), seq_disk_cache_invalidate(), seq_prefetch_do_suspend(), SEQ_render_give_ibuf(), sequencer_preview_add_sound(), view_layer_bases_hash_create(), and write_result_func().
| bool BLI_mutex_trylock | ( | ThreadMutex * | mutex | ) |
Definition at line 411 of file threads.cc.
References mutex.
| void BLI_mutex_unlock | ( | ThreadMutex * | mutex | ) |
Definition at line 406 of file threads.cc.
References mutex.
Referenced by BKE_collection_object_cache_get(), BKE_collection_object_cache_instanced_get(), BKE_image_acquire_ibuf(), BKE_image_ensure_viewer_views(), BKE_image_file_format_set(), BKE_image_free_anim_ibufs(), BKE_image_free_buffers_ex(), BKE_image_get_first_ibuf(), BKE_image_get_ibuf_with_name(), BKE_image_has_ibuf(), BKE_image_has_loaded_ibuf(), BKE_image_is_dirty_writable(), BKE_image_merge(), BKE_image_pool_acquire_ibuf(), BKE_image_pool_free(), BKE_image_release_ibuf(), BKE_image_signal(), BKE_mesh_runtime_looptri_ensure(), BKE_mesh_wrapper_ensure_mdata(), BKE_object_preview_geometry_set_add(), BKE_object_select_update(), BLI_spin_unlock(), bvhcache_find(), bvhcache_unlock(), ccgDM_copyFinalLoopArray(), colorspace_from_scene_linear_cpu_processor(), colorspace_to_scene_linear_cpu_processor(), COM_deinitialize(), COM_execute(), display_from_scene_linear_processor(), display_to_scene_linear_processor(), do_moviecache_put(), drw_deferred_shader_compilation_exec(), DRW_deferred_shader_remove(), eevee_lightbake_delete_resources(), EEVEE_lightbake_job_create(), evaluate_driver_python(), filelist_readjob_do(), filelist_readjob_startjob(), filelist_readjob_update(), blender::compositor::DenoiseOperation::generateDenoise(), give_parvert(), gpu_batch_presets_register(), gpu_batch_presets_unregister(), gpu_free_unused_buffers(), image_free_gpu(), image_mem_size(), IMB_colormanagement_color_picking_to_scene_linear_v3(), IMB_colormanagement_scene_linear_to_color_picking_v3(), imb_global_cache_get_tile(), IMB_moviecache_get(), IMB_moviecache_put_if_possible(), imb_tile_cache_tile_free(), IMB_tiles_to_rect(), mesh_calc_modifiers(), preview_startjob(), RE_engine_update_render_passes(), RE_point_density_cache(), RE_point_density_sample(), schedule_write_result(), screen_opengl_render_end(), seq_cache_create(), seq_cache_get(), seq_cache_put(), seq_cache_unlock(), seq_disk_cache_create(), seq_disk_cache_enforce_limits(), seq_disk_cache_invalidate(), seq_prefetch_do_suspend(), SEQ_render_give_ibuf(), sequencer_preview_add_sound(), blender::compositor::NodeOperation::unlockMutex(), view_layer_bases_hash_create(), and write_result_func().
| ThreadRWMutex* BLI_rw_mutex_alloc | ( | void | ) |
Definition at line 536 of file threads.cc.
References BLI_rw_mutex_init(), MEM_callocN, and mutex.
Referenced by BKE_fluid_modifier_create_type_data(), and BKE_modifier_blend_read_data().
| void BLI_rw_mutex_end | ( | ThreadRWMutex * | mutex | ) |
Definition at line 531 of file threads.cc.
References mutex.
Referenced by BLI_rw_mutex_free(), ccgDM_release(), and RE_FreeRender().
| void BLI_rw_mutex_free | ( | ThreadRWMutex * | mutex | ) |
Definition at line 544 of file threads.cc.
References BLI_rw_mutex_end(), MEM_freeN, and mutex.
Referenced by BKE_fluid_modifier_freeDomain().
| void BLI_rw_mutex_init | ( | ThreadRWMutex * | mutex | ) |
Definition at line 511 of file threads.cc.
References mutex.
Referenced by BLI_rw_mutex_alloc(), getCCGDerivedMesh(), and RE_NewRender().
| void BLI_rw_mutex_lock | ( | ThreadRWMutex * | mutex, |
| int | mode | ||
| ) |
Definition at line 516 of file threads.cc.
References mutex, and THREAD_LOCK_READ.
Referenced by BKE_fluid_modifier_reset_ex(), ccgDM_get_vert_data_layer(), dm_getLoopTriArray(), do_render_compositor(), do_render_sequencer(), psys_update_particle_bvhtree(), RE_AcquireResultImage(), RE_AcquireResultImageViews(), RE_AcquireResultRead(), RE_AcquireResultWrite(), RE_bake_engine(), RE_engine_get_current_tiles(), RE_engine_render(), RE_InitState(), RE_ReadRenderResult(), render_init_from_main(), render_result_exr_file_begin(), render_result_exr_file_end(), render_result_uncrop(), sph_evaluate_func(), vfont_get_data(), and vfont_to_curve().
| void BLI_rw_mutex_unlock | ( | ThreadRWMutex * | mutex | ) |
Definition at line 526 of file threads.cc.
References mutex.
Referenced by BKE_fluid_modifier_reset_ex(), ccgDM_get_vert_data_layer(), dm_getLoopTriArray(), do_render_compositor(), do_render_sequencer(), psys_update_particle_bvhtree(), RE_bake_engine(), RE_engine_get_current_tiles(), RE_engine_render(), RE_InitState(), RE_ReadRenderResult(), RE_ReleaseResult(), RE_ReleaseResultImage(), RE_ReleaseResultImageViews(), render_init_from_main(), render_result_exr_file_begin(), render_result_exr_file_end(), render_result_uncrop(), sph_evaluate_func(), vfont_get_data(), and vfont_to_curve().
| void BLI_spin_end | ( | SpinLock * | spin | ) |
Definition at line 495 of file threads.cc.
References BLI_mutex_end(), and spin.
Referenced by BKE_autotrack_context_free(), BKE_cachefiles_exit(), BKE_main_free(), blf_font_exit(), do_multires_bake(), do_sequence_proxy(), drw_deferred_shader_compilation_free(), dynamics_step(), ED_image_paint_tile_lock_end(), GPU_pass_cache_free(), imb_mmap_lock_exit(), imb_refcounter_lock_exit(), lineart_destroy_render_data(), project_paint_end(), screen_opengl_render_end(), sound_free_data(), start_prefetch_threads(), task_parallel_iterator_do(), tracking_image_accessor_destroy(), tracks_map_free(), and blender::deg::Depsgraph::~Depsgraph().
| void BLI_spin_init | ( | SpinLock * | spin | ) |
Definition at line 447 of file threads.cc.
References BLI_mutex_init(), and spin.
Referenced by BKE_autotrack_context_new(), BKE_cachefiles_init(), BKE_main_new(), BKE_sound_new_file(), blf_font_init(), blender::deg::Depsgraph::Depsgraph(), do_multires_bake(), do_sequence_proxy(), drw_deferred_shader_add(), dynamics_step(), ED_image_paint_tile_lock_init(), GPU_pass_cache_init(), imb_mmap_lock_init(), imb_refcounter_lock_init(), lineart_create_render_buffer(), proj_paint_state_thread_init(), screen_opengl_render_init(), sound_blend_read_data(), sound_copy_data(), start_prefetch_threads(), task_parallel_iterator_do(), tracking_image_accessor_new(), and tracks_map_new().
| void BLI_spin_lock | ( | SpinLock * | spin | ) |
Definition at line 461 of file threads.cc.
References BLI_mutex_lock(), and spin.
Referenced by BKE_autotrack_context_step(), BKE_autotrack_context_sync(), BKE_cachefile_reader_free(), BKE_cachefile_reader_open(), BKE_main_lock(), blf_font_free(), blf_glyph_add(), blf_glyph_cache_acquire(), blf_glyph_cache_clear(), cachefile_handle_free(), do_multires_bake_thread(), draw_seq_waveform_overlay(), drw_deferred_shader_add(), drw_deferred_shader_compilation_exec(), DRW_deferred_shader_remove(), ED_image_paint_tile_push(), GPU_generate_pass(), GPU_pass_cache_free(), GPU_pass_cache_garbage_collect(), gpu_pass_cache_lookup(), gpu_pass_cache_resolve_collision(), IMB_freeImBuf(), IMB_makeSingleUser(), imb_mmap_lock(), IMB_refImBuf(), lineart_discard_segment(), lineart_give_segment(), lineart_mem_aquire_thread(), lineart_occlusion_make_task_info(), multires_bake_queue_next_tri(), parallel_iterator_func_do(), prefetch_thread_next_frame(), preview_startjob(), project_paint_undo_subtiles(), proxy_thread_next_frame(), screen_opengl_render_anim_step(), tracks_map_merge(), update_courant_num(), and write_result_func().
| void BLI_spin_unlock | ( | SpinLock * | spin | ) |
Definition at line 480 of file threads.cc.
References BLI_mutex_unlock(), and spin.
Referenced by BKE_autotrack_context_step(), BKE_autotrack_context_sync(), BKE_cachefile_reader_free(), BKE_cachefile_reader_open(), BKE_main_unlock(), blf_font_free(), blf_glyph_add(), blf_glyph_cache_clear(), blf_glyph_cache_release(), cachefile_handle_free(), do_multires_bake_thread(), draw_seq_waveform_overlay(), drw_deferred_shader_add(), drw_deferred_shader_compilation_exec(), DRW_deferred_shader_remove(), ED_image_paint_tile_push(), GPU_generate_pass(), GPU_pass_cache_free(), GPU_pass_cache_garbage_collect(), gpu_pass_cache_lookup(), gpu_pass_cache_resolve_collision(), IMB_freeImBuf(), IMB_makeSingleUser(), imb_mmap_unlock(), IMB_refImBuf(), lineart_discard_segment(), lineart_give_segment(), lineart_mem_aquire_thread(), lineart_occlusion_make_task_info(), multires_bake_queue_next_tri(), parallel_iterator_func_do(), prefetch_thread_next_frame(), preview_startjob(), project_paint_undo_subtiles(), proxy_thread_next_frame(), screen_opengl_render_anim_step(), tracks_map_merge(), update_courant_num(), and write_result_func().
| int BLI_system_num_threads_override_get | ( | void | ) |
Definition at line 350 of file threads.cc.
References num_threads_override.
Referenced by BKE_render_num_threads(), and BLI_task_scheduler_init().
| void BLI_system_num_threads_override_set | ( | int | num | ) |
Definition at line 345 of file threads.cc.
References num_threads_override.
Referenced by arg_handle_threads_set().
| int BLI_system_thread_count | ( | void | ) |
Definition at line 309 of file threads.cc.
References CLAMP, len, LIKELY, num_threads_override, RE_MAX_THREAD, and t.
Referenced by BKE_render_num_threads(), BLI_task_scheduler_init(), do_movie_proxy(), do_multires_bake(), blender::compositor::ExecutionGroup::execute(), blender::bke::calc_edges::get_parallel_maps_count(), imb_initopenexr(), psys_tasks_create(), and tracking_cameraIntrinscisOptionsFromTracking().
| int BLI_thread_is_main | ( | void | ) |
Definition at line 234 of file threads.cc.
References mainid.
Referenced by BKE_icon_geom_ensure(), BKE_icon_geom_from_file(), BKE_icon_geom_from_memory(), BKE_icon_get(), BKE_icon_gplayer_color_ensure(), BKE_icon_id_delete(), BKE_icon_id_ensure(), BKE_icons_free(), BKE_icons_init(), BKE_image_free_gputextures(), BKE_image_free_unused_gpu_textures(), BKE_previewimg_cached_ensure(), BKE_previewimg_cached_get(), BKE_previewimg_cached_release(), BKE_previewimg_cached_thumbnail_read(), BLT_translate(), BPY_context_update(), ctx_data_get(), ctx_wm_python_context_get(), DRW_gpu_render_context_enable(), DRW_opengl_context_destroy(), DRW_opengl_context_disable_ex(), DRW_opengl_render_context_enable(), ED_preview_ensure_dbase(), ED_render_id_flush_update(), ED_render_scene_update(), eevee_lightbake_context_disable(), eevee_lightbake_context_enable(), EEVEE_lightbake_job(), EEVEE_lightbake_job_data_alloc(), GPU_batch_preset_sphere(), GPU_batch_preset_sphere_wire(), icon_gplayer_color_ensure_create_icon(), icon_id_ensure_create_icon(), image_init_after_load(), SEQ_effect_text_font_load(), seq_render_scene_strip(), wm_file_write(), WM_opengl_context_create(), wm_surface_reset_drawable(), wm_window_process_events(), and wm_window_reset_drawable().
| void BLI_thread_lock | ( | int | type | ) |
Definition at line 384 of file threads.cc.
References global_mutex_from_type(), and type.
Referenced by accessor_get_ibuf(), BKE_image_ensure_viewer_views(), BKE_movieclip_has_cached_frame(), BKE_movieclip_put_frame_if_possible(), colorfn(), blender::compositor::CompositorOperation::deinitExecution(), draw_image_main(), draw_nodespace_back_pix(), image_acquire_ibuf(), image_get_render_result(), image_main_region_draw(), image_mipmap_test(), IMB_display_buffer_acquire(), IMB_display_buffer_release(), imb_partial_display_buffer_update_ex(), IMB_thumb_locks_acquire(), IMB_thumb_locks_release(), IMB_thumb_path_lock(), IMB_thumb_path_unlock(), movieclip_build_proxy_ibuf(), movieclip_get_postprocessed_ibuf(), ntreeTexExecTree(), project_paint_face_init(), save_render_result_tile(), SCULPT_undo_push_node(), and view3d_stereo3d_setup().
| void BLI_thread_put_process_on_fast_node | ( | void | ) |
Definition at line 902 of file threads.cc.
Referenced by main().
| void BLI_thread_put_thread_on_fast_node | ( | void | ) |
Definition at line 918 of file threads.cc.
Referenced by do_job_thread().
| void BLI_thread_queue_free | ( | ThreadQueue * | queue | ) |
Definition at line 657 of file threads.cc.
References BLI_gsqueue_free(), ThreadQueue::finish_cond, MEM_freeN, ThreadQueue::mutex, ThreadQueue::push_cond, ThreadQueue::queue, and blender::compositor::queue.
Referenced by background_task_pool_free(), filelist_cache_previews_free(), blender::compositor::opencl_stop(), and blender::compositor::threading_model_queue_stop().
| ThreadQueue* BLI_thread_queue_init | ( | void | ) |
Definition at line 643 of file threads.cc.
References BLI_gsqueue_new(), ThreadQueue::finish_cond, MEM_callocN, ThreadQueue::mutex, ThreadQueue::push_cond, ThreadQueue::queue, and blender::compositor::queue.
Referenced by background_task_pool_create(), filelist_cache_preview_ensure_running(), blender::compositor::opencl_start(), and blender::compositor::threading_model_queue_start().
| bool BLI_thread_queue_is_empty | ( | ThreadQueue * | queue | ) |
Definition at line 784 of file threads.cc.
References BLI_gsqueue_is_empty(), ThreadQueue::mutex, ThreadQueue::queue, and blender::compositor::queue.
Referenced by filelist_cache_previews_update().
| int BLI_thread_queue_len | ( | ThreadQueue * | queue | ) |
Definition at line 773 of file threads.cc.
References BLI_gsqueue_len(), ThreadQueue::mutex, ThreadQueue::queue, blender::compositor::queue, and size().
| void BLI_thread_queue_nowait | ( | ThreadQueue * | queue | ) |
Definition at line 795 of file threads.cc.
References ThreadQueue::mutex, ThreadQueue::nowait, ThreadQueue::push_cond, and blender::compositor::queue.
Referenced by background_task_pool_cancel(), background_task_pool_work_and_wait(), filelist_cache_previews_free(), blender::compositor::opencl_stop(), and blender::compositor::threading_model_queue_stop().
| void* BLI_thread_queue_pop | ( | ThreadQueue * | queue | ) |
Definition at line 680 of file threads.cc.
References BLI_gsqueue_is_empty(), BLI_gsqueue_pop(), ThreadQueue::finish_cond, ThreadQueue::mutex, ThreadQueue::nowait, ThreadQueue::push_cond, ThreadQueue::queue, and blender::compositor::queue.
Referenced by background_task_pool_cancel(), background_task_run(), filelist_cache_previews_update(), blender::compositor::thread_execute_gpu(), and blender::compositor::threading_model_queue_execute().
| void* BLI_thread_queue_pop_timeout | ( | ThreadQueue * | queue, |
| int | ms | ||
| ) |
Definition at line 739 of file threads.cc.
References BLI_gsqueue_is_empty(), BLI_gsqueue_pop(), ThreadQueue::finish_cond, ThreadQueue::mutex, ThreadQueue::nowait, PIL_check_seconds_timer(), ThreadQueue::push_cond, ThreadQueue::queue, blender::compositor::queue, t, and wait_timeout().
Referenced by filelist_cache_previews_clear().
| void BLI_thread_queue_push | ( | ThreadQueue * | queue, |
| void * | work | ||
| ) |
Definition at line 669 of file threads.cc.
References BLI_gsqueue_push(), ThreadQueue::mutex, ThreadQueue::push_cond, ThreadQueue::queue, and blender::compositor::queue.
Referenced by background_task_pool_run(), filelist_cache_preview_runf(), blender::compositor::opencl_schedule(), and blender::compositor::threading_model_queue_schedule().
| void BLI_thread_queue_wait_finish | ( | ThreadQueue * | queue | ) |
Definition at line 806 of file threads.cc.
References BLI_gsqueue_is_empty(), ThreadQueue::finish_cond, ThreadQueue::mutex, ThreadQueue::queue, and blender::compositor::queue.
Referenced by background_task_pool_work_and_wait(), blender::compositor::opencl_finish(), and blender::compositor::threading_model_queue_finish().
| void BLI_thread_unlock | ( | int | type | ) |
Definition at line 389 of file threads.cc.
References global_mutex_from_type(), and type.
Referenced by accessor_get_ibuf(), BKE_image_ensure_viewer_views(), BKE_image_release_ibuf(), BKE_movieclip_has_cached_frame(), BKE_movieclip_put_frame_if_possible(), colorfn(), blender::compositor::CompositorOperation::deinitExecution(), draw_image_main(), draw_nodespace_back_pix(), image_get_render_result(), image_main_region_draw(), image_mipmap_test(), IMB_display_buffer_acquire(), IMB_display_buffer_release(), imb_partial_display_buffer_update_ex(), IMB_thumb_locks_acquire(), IMB_thumb_locks_release(), IMB_thumb_path_lock(), IMB_thumb_path_unlock(), movieclip_build_proxy_ibuf(), movieclip_get_postprocessed_ibuf(), ntreeTexExecTree(), project_paint_face_init(), save_render_result_tile(), SCULPT_undo_push_node(), and view3d_stereo3d_setup().
| void BLI_threadapi_exit | ( | void | ) |
Definition at line 151 of file threads.cc.
Referenced by task_listbase_test(), BlendfileLoadingBaseTest::TearDownTestCase(), TEST(), and WM_exit_ex().
| void BLI_threadapi_init | ( | void | ) |
Definition at line 143 of file threads.cc.
References is_numa_available, mainid, numaAPI_Initialize(), and NUMAAPI_SUCCESS.
Referenced by main(), BlendfileLoadingBaseTest::SetUpTestCase(), task_listbase_test(), and TEST().
| int BLI_threadpool_available_thread_index | ( | ListBase * | threadbase | ) |
Definition at line 207 of file threads.cc.
References LISTBASE_FOREACH.
| void BLI_threadpool_clear | ( | ListBase * | threadbase | ) |
Definition at line 278 of file threads.cc.
References LISTBASE_FOREACH.
Referenced by background_task_pool_work_and_wait().
| void BLI_threadpool_end | ( | ListBase * | threadbase | ) |
Definition at line 289 of file threads.cc.
References BLI_freelistN(), BLI_listbase_is_empty(), and LISTBASE_FOREACH.
Referenced by background_task_pool_free(), do_multires_bake(), blender::compositor::opencl_stop(), sb_cf_threads_run(), sb_sfesf_threads_run(), seq_prefetch_free(), blender::compositor::threading_model_queue_stop(), wm_jobs_kill_job(), and wm_jobs_timer().
| void BLI_threadpool_init | ( | ListBase * | threadbase, |
| void *(*)(void *) | do_thread, | ||
| int | tot | ||
| ) |
Definition at line 159 of file threads.cc.
References Freestyle::a, atomic_fetch_and_add_u(), ThreadSlot::avail, BLI_addtail(), BLI_listbase_clear(), ThreadSlot::do_thread, MEM_callocN, RE_MAX_THREAD, and thread_levels.
Referenced by background_task_pool_create(), do_multires_bake(), blender::compositor::opencl_start(), sb_cf_threads_run(), sb_sfesf_threads_run(), seq_prefetch_start_ex(), blender::compositor::threading_model_queue_start(), and WM_jobs_start().
| void BLI_threadpool_insert | ( | ListBase * | threadbase, |
| void * | callerdata | ||
| ) |
Definition at line 239 of file threads.cc.
References ThreadSlot::callerdata, LISTBASE_FOREACH, and tslot_thread_start().
Referenced by background_task_pool_run(), do_multires_bake(), blender::compositor::opencl_start(), sb_cf_threads_run(), sb_sfesf_threads_run(), seq_prefetch_start_ex(), blender::compositor::threading_model_queue_start(), and WM_jobs_start().
| void BLI_threadpool_remove | ( | ListBase * | threadbase, |
| void * | callerdata | ||
| ) |
Definition at line 252 of file threads.cc.
References ThreadSlot::callerdata, and LISTBASE_FOREACH.
Referenced by background_task_pool_cancel(), seq_prefetch_free(), and seq_prefetch_start_ex().
| void BLI_threadpool_remove_index | ( | ListBase * | threadbase, |
| int | index | ||
| ) |
Definition at line 263 of file threads.cc.
References LISTBASE_FOREACH.
| TicketMutex* BLI_ticket_mutex_alloc | ( | void | ) |
Definition at line 558 of file threads.cc.
References TicketMutex::cond, MEM_callocN, and TicketMutex::mutex.
Referenced by DRW_opengl_context_create(), and WM_jobs_get().
| void BLI_ticket_mutex_free | ( | TicketMutex * | ticket | ) |
Definition at line 569 of file threads.cc.
References TicketMutex::cond, MEM_freeN, and TicketMutex::mutex.
Referenced by DRW_opengl_context_destroy(), and wm_job_free().
| void BLI_ticket_mutex_lock | ( | TicketMutex * | ticket | ) |
Definition at line 576 of file threads.cc.
References TicketMutex::cond, TicketMutex::mutex, TicketMutex::queue_head, and TicketMutex::queue_tail.
Referenced by DRW_notify_view_update(), DRW_opengl_context_enable_ex(), DRW_opengl_render_context_enable(), WM_job_main_thread_lock_acquire(), and wm_job_main_thread_yield().
| void BLI_ticket_mutex_unlock | ( | TicketMutex * | ticket | ) |
Definition at line 590 of file threads.cc.
References TicketMutex::cond, TicketMutex::mutex, and TicketMutex::queue_head.
Referenced by DRW_notify_view_update(), DRW_opengl_context_disable_ex(), DRW_opengl_render_context_disable(), WM_job_main_thread_lock_release(), and wm_job_main_thread_yield().
|
static |
Definition at line 357 of file threads.cc.
References _colormanage_lock, _custom1_lock, _fftw_lock, _image_draw_lock, _image_lock, _movieclip_lock, _nodes_lock, _view3d_lock, _viewer_lock, BLI_assert, LOCK_COLORMANAGE, LOCK_CUSTOM1, LOCK_DRAW_IMAGE, LOCK_FFTW, LOCK_IMAGE, LOCK_MOVIECLIP, LOCK_NODES, LOCK_VIEW3D, LOCK_VIEWER, and type.
Referenced by BLI_condition_wait_global_mutex(), BLI_thread_lock(), and BLI_thread_unlock().
|
static |
Definition at line 221 of file threads.cc.
References ThreadSlot::callerdata, and ThreadSlot::do_thread.
Referenced by BLI_threadpool_insert().
|
static |
Definition at line 704 of file threads.cc.
References x.
Referenced by BLI_thread_queue_pop_timeout().
|
static |
Definition at line 124 of file threads.cc.
Referenced by global_mutex_from_type().
|
static |
Definition at line 121 of file threads.cc.
Referenced by global_mutex_from_type().
|
static |
Definition at line 125 of file threads.cc.
Referenced by global_mutex_from_type().
|
static |
Definition at line 119 of file threads.cc.
Referenced by global_mutex_from_type().
|
static |
Many thread cases have an X amount of jobs, and only an Y amount of threads are useful (typically amount of CPU's)
This code can be used to start a maximum amount of 'thread slots', which then can be filled in a loop with an idle timer.
A sample loop can look like this (pseudo c);
Definition at line 118 of file threads.cc.
Referenced by global_mutex_from_type().
|
static |
Definition at line 123 of file threads.cc.
Referenced by global_mutex_from_type().
|
static |
Definition at line 122 of file threads.cc.
Referenced by global_mutex_from_type().
|
static |
Definition at line 126 of file threads.cc.
Referenced by global_mutex_from_type().
|
static |
Definition at line 120 of file threads.cc.
Referenced by global_mutex_from_type().
|
static |
Definition at line 128 of file threads.cc.
Referenced by BLI_threadapi_init().
|
static |
Definition at line 127 of file threads.cc.
Referenced by BLI_thread_is_main(), and BLI_threadapi_init().
|
static |
Definition at line 130 of file threads.cc.
Referenced by BLI_system_num_threads_override_get(), BLI_system_num_threads_override_set(), BLI_system_thread_count(), and BLI_task_scheduler_init().
|
static |
Definition at line 129 of file threads.cc.
Referenced by BLI_threadpool_init().