|
Blender V5.0
|
#include <algorithm>#include <cerrno>#include <cstdio>#include <cstdlib>#include <deque>#include "MEM_guardedalloc.h"#include "BLI_listbase.h"#include "BLI_threads.h"#include "BLI_time.h"#include "BLI_utildefines.h"#include <sys/time.h>#include <unistd.h>#include "atomic_ops.h"Go to the source code of this file.
Classes | |
| struct | ThreadSlot |
| struct | TicketMutex |
| struct | ThreadQueueWork |
| 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 uint | thread_levels = 0 |
| static int | threads_override_num = 0 |
| #define RE_MAX_THREAD BLENDER_MAX_THREADS |
Definition at line 104 of file threads.cc.
Referenced by BLI_system_thread_count(), and BLI_threadpool_init().
| int BLI_available_threads | ( | struct ListBase * | threadbase | ) |
Amount of available threads.
Definition at line 146 of file threads.cc.
References LISTBASE_FOREACH.
Referenced by ZstdWriteWrap::write().
| void BLI_condition_end | ( | ThreadCondition * | cond | ) |
Definition at line 600 of file threads.cc.
Referenced by ZstdWriteWrap::close(), IMB_thumb_locks_release(), and blender::seq::seq_prefetch_free().
| void BLI_condition_init | ( | ThreadCondition * | cond | ) |
Definition at line 575 of file threads.cc.
Referenced by IMB_thumb_locks_acquire(), ZstdWriteWrap::open(), blender::seq::seq_prefetch_start_ex(), and blender::ed::vse::sequencer_preview_add_sound().
| void BLI_condition_notify_all | ( | ThreadCondition * | cond | ) |
Definition at line 595 of file threads.cc.
Referenced by IMB_thumb_path_unlock().
| void BLI_condition_notify_one | ( | ThreadCondition * | cond | ) |
Definition at line 590 of file threads.cc.
Referenced by blender::ed::vse::free_read_sound_waveform_task(), blender::seq::prefetch_stop(), blender::seq::seq_prefetch_resume(), and blender::ed::vse::sequencer_preview_add_sound().
| void BLI_condition_wait | ( | ThreadCondition * | cond, |
| ThreadMutex * | mutex ) |
Definition at line 580 of file threads.cc.
References mutex.
Referenced by blender::ed::vse::preview_startjob(), and blender::seq::seq_prefetch_do_suspend().
| void BLI_condition_wait_global_mutex | ( | ThreadCondition * | cond, |
| const int | type ) |
Definition at line 585 of file threads.cc.
References global_mutex_from_type().
Referenced by IMB_thumb_path_lock().
| ThreadMutex * BLI_mutex_alloc | ( | void | ) |
Definition at line 365 of file threads.cc.
References BLI_mutex_init(), MEM_callocN(), and mutex.
Referenced by blender::ed::vse::sequencer_preview_add_sound().
| void BLI_mutex_end | ( | ThreadMutex * | mutex | ) |
Definition at line 360 of file threads.cc.
References mutex.
Referenced by BLI_mutex_free(), BLI_spin_end(), ZstdWriteWrap::close(), gpu_batch_presets_exit(), RE_engine_free(), blender::seq::seq_prefetch_free(), and BaseRender::~BaseRender().
| void BLI_mutex_free | ( | ThreadMutex * | mutex | ) |
Definition at line 372 of file threads.cc.
References BLI_mutex_end(), MEM_freeN(), and mutex.
Referenced by blender::ed::vse::free_preview_job().
| void BLI_mutex_init | ( | ThreadMutex * | mutex | ) |
Definition at line 340 of file threads.cc.
References mutex.
Referenced by BLI_mempool_create(), BLI_mutex_alloc(), BLI_spin_init(), gpu_batch_presets_init(), ZstdWriteWrap::open(), RE_engine_create(), and blender::seq::seq_prefetch_start_ex().
| void BLI_mutex_lock | ( | ThreadMutex * | mutex | ) |
Definition at line 345 of file threads.cc.
References mutex.
Referenced by BLI_spin_lock(), engine_render_view_layer(), blender::ed::vse::free_read_sound_waveform_task(), gpu_batch_presets_register(), gpu_batch_storage_buffer_register(), IMB_colormanagement_color_picking_to_scene_linear_v3(), IMB_colormanagement_scene_linear_to_color_picking_v3(), mempool_asan_lock(), blender::ed::vse::preview_startjob(), RE_engine_draw_acquire(), RE_engine_gpu_context_enable(), RE_engine_gpu_context_lock(), RE_engine_update_render_passes(), blender::seq::seq_prefetch_do_suspend(), blender::ed::vse::sequencer_preview_add_sound(), and ZstdWriteWrap::write().
| bool BLI_mutex_trylock | ( | ThreadMutex * | mutex | ) |
Definition at line 355 of file threads.cc.
References mutex.
| void BLI_mutex_unlock | ( | ThreadMutex * | mutex | ) |
Definition at line 350 of file threads.cc.
References mutex.
Referenced by BLI_spin_unlock(), engine_render_view_layer(), blender::ed::vse::free_read_sound_waveform_task(), gpu_batch_presets_register(), gpu_batch_storage_buffer_register(), IMB_colormanagement_color_picking_to_scene_linear_v3(), IMB_colormanagement_scene_linear_to_color_picking_v3(), mempool_asan_unlock(), blender::ed::vse::preview_startjob(), RE_engine_draw_acquire(), RE_engine_draw_release(), RE_engine_gpu_context_disable(), RE_engine_gpu_context_unlock(), RE_engine_update_render_passes(), blender::seq::seq_prefetch_do_suspend(), blender::ed::vse::sequencer_preview_add_sound(), and ZstdWriteWrap::write().
| ThreadRWMutex * BLI_rw_mutex_alloc | ( | void | ) |
Definition at line 487 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 482 of file threads.cc.
References mutex.
Referenced by BLI_rw_mutex_free(), and BaseRender::~BaseRender().
| void BLI_rw_mutex_free | ( | ThreadRWMutex * | mutex | ) |
Definition at line 494 of file threads.cc.
References BLI_rw_mutex_end(), MEM_freeN(), and mutex.
Referenced by fluid_modifier_freeDomain().
| void BLI_rw_mutex_init | ( | ThreadRWMutex * | mutex | ) |
| void BLI_rw_mutex_lock | ( | ThreadRWMutex * | mutex, |
| int | mode ) |
Definition at line 467 of file threads.cc.
References mutex, and THREAD_LOCK_READ.
Referenced by do_render_compositor(), do_render_sequencer(), fluid_modifier_reset_ex(), psys_update_particle_bvhtree(), RE_AcquireResultImage(), RE_AcquireResultImageViews(), RE_AcquireResultRead(), RE_AcquireResultWrite(), RE_engine_render(), re_ensure_passes_allocated_thread_safe(), RE_InitState(), RE_ReadRenderResult(), render_init_from_main(), render_result_uncrop(), renderresult_set_passes_metadata(), sph_evaluate_func(), vfont_char_ensure_with_lock(), and vfont_data_ensure_with_lock().
| void BLI_rw_mutex_unlock | ( | ThreadRWMutex * | mutex | ) |
Definition at line 477 of file threads.cc.
References mutex.
Referenced by do_render_compositor(), do_render_sequencer(), fluid_modifier_reset_ex(), psys_update_particle_bvhtree(), RE_engine_render(), re_ensure_passes_allocated_thread_safe(), RE_InitState(), RE_ReadRenderResult(), RE_ReleaseResult(), RE_ReleaseResultImage(), RE_ReleaseResultImageViews(), render_init_from_main(), render_result_uncrop(), renderresult_set_passes_metadata(), sph_evaluate_func(), vfont_char_ensure_with_lock(), and vfont_data_ensure_with_lock().
| void BLI_spin_end | ( | SpinLock * | spin | ) |
Definition at line 445 of file threads.cc.
References BLI_mutex_end(), and UNUSED_VARS.
Referenced by BKE_autotrack_context_free(), dynamics_step(), ED_image_paint_tile_lock_end(), lineart_destroy_render_data(), lineart_end_bounding_area_recursive(), lineart_free_bounding_area_memory(), project_paint_end(), sound_free_data(), tracking_image_accessor_destroy(), tracks_map_free(), blender::deg::Depsgraph::~Depsgraph(), and Main::~Main().
| void BLI_spin_init | ( | SpinLock * | spin | ) |
Definition at line 391 of file threads.cc.
References BLI_mutex_init().
Referenced by BKE_autotrack_context_new(), BKE_sound_new_file(), blender::deg::Depsgraph::Depsgraph(), dynamics_step(), ED_image_paint_tile_lock_init(), lineart_bounding_area_split(), lineart_create_render_buffer_v3(), lineart_main_bounding_area_make_initial(), lineart_main_try_generate_shadow_v3(), Main::Main(), proj_paint_state_thread_init(), sound_blend_read_data(), sound_copy_data(), tracking_image_accessor_new(), and tracks_map_new().
| void BLI_spin_lock | ( | SpinLock * | spin | ) |
Definition at line 405 of file threads.cc.
References BLI_mutex_lock(), and long.
Referenced by BKE_autotrack_context_step(), BKE_autotrack_context_sync(), BKE_main_lock(), blender::ed::vse::clear_sound_waveform_loading_tag(), ED_image_paint_tile_push(), lineart_bounding_area_link_triangle(), lineart_discard_segment(), lineart_geometry_object_load(), lineart_give_segment(), lineart_give_shadow_segment(), lineart_mem_acquire_thread(), lineart_occlusion_make_task_info(), lineart_schedule_new_triangle_task(), project_paint_undo_subtiles(), tracks_map_merge(), update_courant_num(), and blender::ed::vse::waveform_job_start_if_needed().
| void BLI_spin_unlock | ( | SpinLock * | spin | ) |
Definition at line 430 of file threads.cc.
References BLI_mutex_unlock().
Referenced by BKE_autotrack_context_step(), BKE_autotrack_context_sync(), BKE_main_unlock(), blender::ed::vse::clear_sound_waveform_loading_tag(), ED_image_paint_tile_push(), lineart_bounding_area_link_triangle(), lineart_discard_segment(), lineart_geometry_object_load(), lineart_give_segment(), lineart_give_shadow_segment(), lineart_mem_acquire_thread(), lineart_occlusion_make_task_info(), lineart_schedule_new_triangle_task(), project_paint_undo_subtiles(), tracks_map_merge(), update_courant_num(), and blender::ed::vse::waveform_job_start_if_needed().
| int BLI_system_num_threads_override_get | ( | void | ) |
Definition at line 294 of file threads.cc.
References threads_override_num.
Referenced by BKE_render_num_threads(), BLI_task_scheduler_init(), and OIIO_init().
| void BLI_system_num_threads_override_set | ( | int | num | ) |
Definition at line 289 of file threads.cc.
References num, and threads_override_num.
Referenced by arg_handle_threads_set().
| int BLI_system_thread_count | ( | void | ) |
Definition at line 253 of file threads.cc.
References CLAMP, len, LIKELY, RE_MAX_THREAD, and threads_override_num.
Referenced by arg_handle_gpu_compilation_subprocesses_set(), BKE_render_num_threads(), BLI_task_scheduler_init(), blender::gpu::VKBackend::capabilities_init(), blender::fn::multi_function::compute_grain_size(), blender::array_utils::count_indices(), blender::index_mask::IndexMask::from_indices(), blender::bke::calc_edges::get_parallel_maps_count(), imb_initopenexr(), blender::fftw::initialize_float(), ZstdWriteWrap::open(), and psys_tasks_create().
| int BLI_thread_is_main | ( | void | ) |
Definition at line 179 of file threads.cc.
References mainid.
Referenced by blender::gpu::GPUSecondaryContext::activate(), 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(), BLI_change_working_dir(), BLT_translate(), BPY_context_update(), ctx_data_get(), ctx_wm_python_context_get(), blender::gpu::VKDevice::debug_print(), ContextShared::disable(), blender::draw::DebugDraw::display_to_view(), DRW_blender_gpu_render_context_enable(), DRW_gpu_context_activate(), DRW_gpu_context_destroy(), DRW_gpu_context_release(), DRW_system_gpu_render_context_enable(), ED_preview_ensure_dbase(), ED_render_id_flush_update(), ED_render_scene_update(), engine_depsgraph_free(), RenderDisplay::ensure_system_gpu_context(), blender::render::Compositor::execute(), GPU_batch_preset_sphere(), GPU_batch_preset_sphere_wire(), blender::gpu::GPUSecondaryContext::GPUSecondaryContext(), icon_gplayer_color_ensure_create_icon(), icon_id_ensure_create_icon(), image_init_after_load(), blender::eevee::LightBake::LightBake(), RE_engine_gpu_context_create(), RE_FreeUnusedGPUResources(), blender::gpu::VKBackend::render_end(), blender::eevee::LightBake::update(), wm_file_write(), wm_job_end(), wm_surface_reset_drawable(), WM_system_gpu_context_create(), wm_window_events_process(), wm_window_reset_drawable(), blender::render::Compositor::~Compositor(), blender::gpu::GPUSecondaryContext::~GPUSecondaryContext(), blender::eevee::LightBake::~LightBake(), and RenderDisplay::~RenderDisplay().
| void BLI_thread_lock | ( | int | type | ) |
Definition at line 328 of file threads.cc.
References global_mutex_from_type().
Referenced by accessor_get_ibuf(), BKE_image_ensure_viewer_views(), BKE_movieclip_get_cache_segments(), BKE_movieclip_has_cached_frame(), BKE_movieclip_put_frame_if_possible(), colorfn(), blender::ed::space_node::draw_nodespace_back_pix(), image_acquire_ibuf(), image_get_render_result(), image_main_region_draw(), blender::nodes::node_geo_image_texture_cc::ImageFieldsFunction::ImageFieldsFunction(), 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(), blender::render::Context::output_to_render_result(), project_paint_face_init(), view3d_stereo3d_setup(), and blender::render::Context::viewer_output_to_viewer_image().
| void BLI_thread_queue_cancel_work | ( | ThreadQueue * | queue, |
| uint64_t | work_id ) |
Remove the corresponding work from the queue.
Definition at line 684 of file threads.cc.
References check_finalization(), ThreadQueue::mutex, ThreadQueue::queue_high_priority, ThreadQueue::queue_low_priority, and ThreadQueue::queue_normal_priority.
| void BLI_thread_queue_free | ( | ThreadQueue * | queue | ) |
Deallocate the ThreadQueue. Assumes no one is using the queue anymore.
Definition at line 635 of file threads.cc.
References ThreadQueue::finish_cond, ThreadQueue::mutex, and ThreadQueue::push_cond.
Referenced by filelist_cache_previews_free(), PreviewLoadJob::~PreviewLoadJob(), and TaskPool::~TaskPool().
| ThreadQueue * BLI_thread_queue_init | ( | void | ) |
Allocate a new ThreadQueue.
Definition at line 624 of file threads.cc.
References ThreadQueue::finish_cond, ThreadQueue::mutex, and ThreadQueue::push_cond.
Referenced by filelist_cache_preview_ensure_running(), PreviewLoadJob::PreviewLoadJob(), and TaskPool::TaskPool().
| bool BLI_thread_queue_is_empty | ( | ThreadQueue * | queue | ) |
Definition at line 839 of file threads.cc.
References ThreadQueue::mutex, ThreadQueue::queue_high_priority, ThreadQueue::queue_low_priority, and ThreadQueue::queue_normal_priority.
Referenced by filelist_cache_previews_update().
| int BLI_thread_queue_len | ( | ThreadQueue * | queue | ) |
Definition at line 827 of file threads.cc.
References ThreadQueue::mutex, ThreadQueue::queue_high_priority, ThreadQueue::queue_low_priority, ThreadQueue::queue_normal_priority, and size().
| void BLI_thread_queue_nowait | ( | ThreadQueue * | queue | ) |
After calling this function, BLI_thread_queue_pop and BLI_thread_queue_pop_timeout won't block the calling thread even when the queue is empty.
Definition at line 851 of file threads.cc.
References ThreadQueue::mutex, ThreadQueue::nowait, and ThreadQueue::push_cond.
Referenced by filelist_cache_previews_free().
| void * BLI_thread_queue_pop | ( | ThreadQueue * | queue | ) |
Pop the oldest, highest priority work from the queue. Blocks the calling thread unless BLI_thread_queue_nowait has been called for this queue.
Definition at line 712 of file threads.cc.
References check_finalization(), ThreadQueue::mutex, ThreadQueue::nowait, ThreadQueue::push_cond, ThreadQueue::queue_high_priority, ThreadQueue::queue_low_priority, ThreadQueue::queue_normal_priority, and ThreadQueueWork::work.
Referenced by filelist_cache_previews_update().
| void * BLI_thread_queue_pop_timeout | ( | ThreadQueue * | queue, |
| int | ms ) |
Try to pop the oldest, highest priority work from the queue. Blocks the calling thread unless BLI_thread_queue_nowait has been called for this queue.
Definition at line 782 of file threads.cc.
References BLI_time_now_seconds(), check_finalization(), ThreadQueue::mutex, ThreadQueue::nowait, ThreadQueue::push_cond, ThreadQueue::queue_high_priority, ThreadQueue::queue_low_priority, ThreadQueue::queue_normal_priority, wait_timeout(), and ThreadQueueWork::work.
Referenced by filelist_cache_previews_clear(), blender::gpu::VKDevice::render_graph_new(), and blender::gpu::VKDevice::submission_runner().
| uint64_t BLI_thread_queue_push | ( | ThreadQueue * | queue, |
| void * | work, | ||
| ThreadQueueWorkPriority | priority ) |
Push one work pointer to the queue. Higher priority works always take priority over lower priority ones, regardless of their insertion order. Works within the same priority follow FIFO order.
Definition at line 645 of file threads.cc.
References BLI_assert, BLI_THREAD_QUEUE_WORK_PRIORITY_HIGH, BLI_THREAD_QUEUE_WORK_PRIORITY_LOW, BLI_THREAD_QUEUE_WORK_PRIORITY_NORMAL, ThreadQueue::current_id, ThreadQueueWork::id, ThreadQueue::mutex, ThreadQueue::push_cond, ThreadQueue::queue_high_priority, ThreadQueue::queue_low_priority, ThreadQueue::queue_normal_priority, and ThreadQueueWork::work.
Referenced by blender::gpu::VKDevice::context_unregister(), filelist_cache_preview_runf(), filelist_cache_previews_push(), PreviewLoadJob::push_load_request(), blender::gpu::VKDevice::render_graph_submit(), and blender::gpu::VKDevice::submission_runner().
| void BLI_thread_queue_wait_finish | ( | ThreadQueue * | queue | ) |
Blocks the calling thread until the queue is empty.
Definition at line 862 of file threads.cc.
References ThreadQueue::finish_cond, ThreadQueue::mutex, ThreadQueue::queue_high_priority, ThreadQueue::queue_low_priority, and ThreadQueue::queue_normal_priority.
| void BLI_thread_unlock | ( | int | type | ) |
Definition at line 333 of file threads.cc.
References global_mutex_from_type().
Referenced by accessor_get_ibuf(), BKE_image_ensure_viewer_views(), BKE_image_release_ibuf(), BKE_movieclip_get_cache_segments(), BKE_movieclip_has_cached_frame(), BKE_movieclip_put_frame_if_possible(), colorfn(), blender::ed::space_node::draw_nodespace_back_pix(), image_main_region_draw(), blender::nodes::node_geo_image_texture_cc::ImageFieldsFunction::ImageFieldsFunction(), 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(), blender::render::Context::output_to_render_result(), project_paint_face_init(), view3d_stereo3d_setup(), and blender::render::Context::viewer_output_to_viewer_image().
| void BLI_threadapi_exit | ( | void | ) |
Definition at line 119 of file threads.cc.
Referenced by blender::tests::ChangeWorkingDirectoryTest::TearDown(), BlendfileLoadingBaseTest::TearDownTestCase(), TEST(), TEST(), TEST(), and WM_exit_ex().
| void BLI_threadapi_init | ( | void | ) |
This is run once at startup.
Definition at line 114 of file threads.cc.
References mainid.
Referenced by main(), blender::tests::ChangeWorkingDirectoryTest::SetUp(), BlendfileLoadingBaseTest::SetUpTestCase(), blender::gpu::GPUTest::SetUpTestSuite(), TEST(), TEST(), and TEST().
| int BLI_threadpool_available_thread_index | ( | struct ListBase * | threadbase | ) |
Returns thread number, for sample patterns or threadsafe tables.
Definition at line 159 of file threads.cc.
References LISTBASE_FOREACH.
| void BLI_threadpool_clear | ( | ListBase * | threadbase | ) |
Definition at line 223 of file threads.cc.
References LISTBASE_FOREACH.
| void BLI_threadpool_end | ( | ListBase * | threadbase | ) |
Definition at line 234 of file threads.cc.
References BLI_freelistN(), BLI_listbase_is_empty(), and LISTBASE_FOREACH.
Referenced by ZstdWriteWrap::close(), sb_cf_threads_run(), sb_sfesf_threads_run(), blender::seq::seq_prefetch_free(), wm_jobs_kill_job(), wm_jobs_timer(), and TaskPool::~TaskPool().
| void BLI_threadpool_init | ( | struct ListBase * | threadbase, |
| void *(* | do_thread )(void *), | ||
| int | tot ) |
| tot | When 0 only initializes malloc mutex in a safe way (see sequence.c) problem otherwise: scene render will kill of the mutex! |
Definition at line 121 of file threads.cc.
References 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 ZstdWriteWrap::open(), sb_cf_threads_run(), sb_sfesf_threads_run(), blender::seq::seq_prefetch_start_ex(), TaskPool::TaskPool(), and WM_jobs_start().
| void BLI_threadpool_insert | ( | ListBase * | threadbase, |
| void * | callerdata ) |
Definition at line 184 of file threads.cc.
References LISTBASE_FOREACH, printf, and tslot_thread_start().
Referenced by sb_cf_threads_run(), sb_sfesf_threads_run(), blender::seq::seq_prefetch_start_ex(), WM_jobs_start(), and ZstdWriteWrap::write().
| void BLI_threadpool_remove | ( | ListBase * | threadbase, |
| void * | callerdata ) |
Definition at line 197 of file threads.cc.
References LISTBASE_FOREACH.
Referenced by blender::seq::seq_prefetch_free(), blender::seq::seq_prefetch_start_ex(), and ZstdWriteWrap::write().
| void BLI_threadpool_remove_index | ( | ListBase * | threadbase, |
| int | index ) |
Definition at line 208 of file threads.cc.
References LISTBASE_FOREACH.
| TicketMutex * BLI_ticket_mutex_alloc | ( | void | ) |
Definition at line 510 of file threads.cc.
References TicketMutex::cond, MEM_callocN(), and TicketMutex::mutex.
Referenced by ContextShared::ContextShared(), DRW_mutexes_init(), and WM_jobs_get().
| void BLI_ticket_mutex_free | ( | TicketMutex * | ticket | ) |
Definition at line 520 of file threads.cc.
References TicketMutex::cond, MEM_freeN(), and TicketMutex::mutex.
Referenced by DRW_mutexes_exit(), wm_job_free(), and ContextShared::~ContextShared().
| void BLI_ticket_mutex_lock | ( | TicketMutex * | ticket | ) |
Definition at line 552 of file threads.cc.
References ticket_mutex_lock().
Referenced by ContextShared::enable(), WM_job_main_thread_lock_acquire(), and wm_job_main_thread_yield().
| bool BLI_ticket_mutex_lock_check_recursive | ( | TicketMutex * | ticket | ) |
Definition at line 557 of file threads.cc.
References ticket_mutex_lock().
Referenced by DRW_lock_start(), and DRW_submission_start().
| void BLI_ticket_mutex_unlock | ( | TicketMutex * | ticket | ) |
Definition at line 562 of file threads.cc.
References TicketMutex::cond, TicketMutex::has_owner, TicketMutex::mutex, and TicketMutex::queue_head.
Referenced by ContextShared::disable(), DRW_lock_end(), DRW_submission_end(), WM_job_main_thread_lock_release(), and wm_job_main_thread_yield().
|
static |
WARNING: Assumes the queue is already locked.
Definition at line 675 of file threads.cc.
References ThreadQueue::finish_cond, ThreadQueue::queue_high_priority, ThreadQueue::queue_low_priority, and ThreadQueue::queue_normal_priority.
Referenced by BLI_thread_queue_cancel_work(), BLI_thread_queue_pop(), and BLI_thread_queue_pop_timeout().
|
static |
Definition at line 301 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_unreachable, LOCK_COLORMANAGE, LOCK_CUSTOM1, LOCK_DRAW_IMAGE, LOCK_FFTW, LOCK_IMAGE, LOCK_MOVIECLIP, LOCK_NODES, LOCK_VIEW3D, and LOCK_VIEWER.
Referenced by BLI_condition_wait_global_mutex(), BLI_thread_lock(), and BLI_thread_unlock().
|
static |
Definition at line 527 of file threads.cc.
References TicketMutex::cond, TicketMutex::has_owner, TicketMutex::mutex, TicketMutex::owner, TicketMutex::queue_head, and TicketMutex::queue_tail.
Referenced by BLI_ticket_mutex_lock(), and BLI_ticket_mutex_lock_check_recursive().
|
static |
Definition at line 173 of file threads.cc.
References ThreadSlot::callerdata, and ThreadSlot::do_thread.
Referenced by BLI_threadpool_insert().
|
static |
Definition at line 747 of file threads.cc.
References x.
Referenced by BLI_thread_queue_pop_timeout().
|
static |
Definition at line 96 of file threads.cc.
Referenced by global_mutex_from_type().
|
static |
Definition at line 93 of file threads.cc.
Referenced by global_mutex_from_type().
|
static |
Definition at line 97 of file threads.cc.
Referenced by global_mutex_from_type().
|
static |
Definition at line 91 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 90 of file threads.cc.
Referenced by global_mutex_from_type().
|
static |
Definition at line 95 of file threads.cc.
Referenced by global_mutex_from_type().
|
static |
Definition at line 94 of file threads.cc.
Referenced by global_mutex_from_type().
|
static |
Definition at line 98 of file threads.cc.
Referenced by global_mutex_from_type().
|
static |
Definition at line 92 of file threads.cc.
Referenced by global_mutex_from_type().
|
static |
Definition at line 99 of file threads.cc.
Referenced by BLI_thread_is_main(), and BLI_threadapi_init().
|
static |
Definition at line 100 of file threads.cc.
Referenced by BLI_threadpool_init().
|
static |
Definition at line 101 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().