Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
dtpthread.h File Reference
#include "external/ThreadSafetyAnalysis.h"
#include <assert.h>
#include <errno.h>
#include <float.h>
#include <glib.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
+ Include dependency graph for dtpthread.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define dt_pthread_rwlock_rdlock_with_caller(A, B, C)   dt_pthread_rwlock_rdlock(A)
 
#define dt_pthread_rwlock_wrlock_with_caller(A, B, C)   dt_pthread_rwlock_wrlock(A)
 
#define dt_pthread_rwlock_tryrdlock_with_caller(A, B, C)   dt_pthread_rwlock_tryrdlock(A)
 
#define dt_pthread_rwlock_trywrlock_with_caller(A, B, C)   dt_pthread_rwlock_trywrlock(A)
 

Functions

struct CAPABILITY ("mutex") dt_pthread_mutex_t
 
static int dt_pthread_mutex_init (dt_pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr)
 Initialise a mutex. With mutexattr NULL – which is how 54 of the 56 call sites in this tree spell it – the mutex is RECURSIVE.
 
static int dt_pthread_mutex_lock (dt_pthread_mutex_t *mutex) ACQUIRE(mutex) NO_THREAD_SAFETY_ANALYSIS
 
static int dt_pthread_mutex_trylock (dt_pthread_mutex_t *mutex) TRY_ACQUIRE(0
 
static int dt_pthread_mutex_unlock (dt_pthread_mutex_t *mutex) RELEASE(mutex) NO_THREAD_SAFETY_ANALYSIS
 
static int dt_pthread_mutex_destroy (dt_pthread_mutex_t *mutex)
 
static int dt_pthread_cond_wait (pthread_cond_t *cond, dt_pthread_mutex_t *mutex)
 Wait on cond, releasing mutex for the duration.
 
struct CAPABILITY ("rwlock") dt_pthread_rwlock_t
 
static int dt_pthread_rwlock_init (dt_pthread_rwlock_t *lock, const pthread_rwlockattr_t *attr)
 
static void dt_pthread_rwlock_set_name (dt_pthread_rwlock_t *lock, const char *name)
 
static int dt_pthread_rwlock_destroy (dt_pthread_rwlock_t *lock)
 
static int dt_pthread_rwlock_unlock (dt_pthread_rwlock_t *rwlock) RELEASE_GENERIC(rwlock) NO_THREAD_SAFETY_ANALYSIS
 
void _dt_pthread_rwlock_diag_log_rdlock (const char *name, unsigned long tid, double wait_ms, unsigned long prev_holder, gboolean prev_was_writer)
 
void _dt_pthread_rwlock_diag_log_wrlock (const char *name, unsigned long tid, double wait_ms, unsigned long prev_holder, gboolean prev_was_writer, int active_readers, unsigned long oldest_reader_tid, double oldest_reader_age_ms)
 
static double _dt_pthread_rwlock_diag_now (void)
 
static int dt_pthread_rwlock_rdlock (dt_pthread_rwlock_t *rwlock) ACQUIRE_SHARED(rwlock) NO_THREAD_SAFETY_ANALYSIS
 
static int dt_pthread_rwlock_wrlock (dt_pthread_rwlock_t *rwlock) ACQUIRE(rwlock) NO_THREAD_SAFETY_ANALYSIS
 
static int dt_pthread_rwlock_tryrdlock (dt_pthread_rwlock_t *rwlock) TRY_ACQUIRE_SHARED(0
 
static int dt_pthread_rwlock_trywrlock (dt_pthread_rwlock_t *rwlock) TRY_ACQUIRE(0
 
 if (!res)
 
static int dt_pthread_mutex_BAD_lock (dt_pthread_mutex_t *mutex)
 
static int dt_pthread_mutex_BAD_trylock (dt_pthread_mutex_t *mutex)
 
static int dt_pthread_mutex_BAD_unlock (dt_pthread_mutex_t *mutex)
 
int dt_pthread_create (pthread_t *thread, void *(*start_routine)(void *), void *arg, const gboolean realtime)
 
void dt_pthread_setname (const char *name)
 

Variables

static int mutex
 
static int rwlock NO_THREAD_SAFETY_ANALYSIS
 
return pthread_rwlock_tryrdlock & rwlock
 
const int res = pthread_rwlock_trywrlock(&rwlock->lock)
 

Macro Definition Documentation

◆ dt_pthread_rwlock_rdlock_with_caller

#define dt_pthread_rwlock_rdlock_with_caller (   A,
  B,
  C 
)    dt_pthread_rwlock_rdlock(A)

Definition at line 360 of file dtpthread.h.

◆ dt_pthread_rwlock_tryrdlock_with_caller

#define dt_pthread_rwlock_tryrdlock_with_caller (   A,
  B,
  C 
)    dt_pthread_rwlock_tryrdlock(A)

Definition at line 362 of file dtpthread.h.

◆ dt_pthread_rwlock_trywrlock_with_caller

#define dt_pthread_rwlock_trywrlock_with_caller (   A,
  B,
  C 
)    dt_pthread_rwlock_trywrlock(A)

Definition at line 363 of file dtpthread.h.

◆ dt_pthread_rwlock_wrlock_with_caller

#define dt_pthread_rwlock_wrlock_with_caller (   A,
  B,
  C 
)    dt_pthread_rwlock_wrlock(A)

Definition at line 361 of file dtpthread.h.

Function Documentation

◆ _dt_pthread_rwlock_diag_log_rdlock()

void _dt_pthread_rwlock_diag_log_rdlock ( const char *  name,
unsigned long  tid,
double  wait_ms,
unsigned long  prev_holder,
gboolean  prev_was_writer 
)

Definition at line 128 of file dtpthread.c.

References DT_DEBUG_HISTORY, dt_print(), and name.

Referenced by dt_pthread_rwlock_rdlock().

◆ _dt_pthread_rwlock_diag_log_wrlock()

void _dt_pthread_rwlock_diag_log_wrlock ( const char *  name,
unsigned long  tid,
double  wait_ms,
unsigned long  prev_holder,
gboolean  prev_was_writer,
int  active_readers,
unsigned long  oldest_reader_tid,
double  oldest_reader_age_ms 
)

Definition at line 135 of file dtpthread.c.

References DT_DEBUG_HISTORY, dt_print(), and name.

Referenced by dt_pthread_rwlock_wrlock().

◆ _dt_pthread_rwlock_diag_now()

static double _dt_pthread_rwlock_diag_now ( void  )
inlinestatic

Definition at line 260 of file dtpthread.h.

Referenced by dt_pthread_rwlock_rdlock(), and dt_pthread_rwlock_wrlock().

◆ CAPABILITY() [1/2]

CAPABILITY ( "mutex"  )

Definition at line 1 of file dtpthread.h.

References mutex.

◆ CAPABILITY() [2/2]

CAPABILITY ( "rwlock"  )

Definition at line 149 of file dtpthread.h.

References mutex.

◆ dt_pthread_cond_wait()

static int dt_pthread_cond_wait ( pthread_cond_t *  cond,
dt_pthread_mutex_t *  mutex 
)
inlinestatic

Wait on cond, releasing mutex for the duration.

Warning
mutex must be held EXACTLY ONCE by the calling thread. Mutexes from dt_pthread_mutex_init(..., NULL) are recursive, and pthread_cond_wait() releases a mutex once regardless of how deep the caller holds it: waiting at depth > 1 leaves it held, so no other thread can take it to signal, and the wait never returns. POSIX calls this undefined; in practice it is a silent hang.

Every wait in this tree takes its mutex at the top of a loop and waits at depth 1, which is the shape this is safe in. If you ever need to wait from inside a nested critical section, unwind to depth 1 first – do not add a "recursive wait".

Definition at line 149 of file dtpthread.h.

Referenced by _drawlayer_worker_main(), _dt_delete_file_display_modal_dialog(), _pause_worker(), _wait_worker_idle(), dt_control_work(), dt_control_work_res(), and dt_view_image_surface_fetcher_cleanup().

◆ dt_pthread_create()

int dt_pthread_create ( pthread_t *  thread,
void *(*)(void *)  start_routine,
void arg,
const gboolean  realtime 
)

Definition at line 52 of file dtpthread.c.

References dt_conf_get_int(), param, and WANTED_THREADS_STACK_SIZE.

Referenced by _start_worker(), and dt_control_jobs_init().

◆ dt_pthread_mutex_BAD_lock()

static int dt_pthread_mutex_BAD_lock ( dt_pthread_mutex_t *  mutex)
inlinestatic

Definition at line 367 of file dtpthread.h.

References mutex.

Referenced by dt_iop_gui_enter_critical_section(), and dt_opencl_reserve_device_by_id().

◆ dt_pthread_mutex_BAD_trylock()

static int dt_pthread_mutex_BAD_trylock ( dt_pthread_mutex_t *  mutex)
inlinestatic

Definition at line 372 of file dtpthread.h.

References mutex.

Referenced by dt_opencl_reserve_device_for_pipe(), and dt_opencl_try_reserve_device_by_id().

◆ dt_pthread_mutex_BAD_unlock()

static int dt_pthread_mutex_BAD_unlock ( dt_pthread_mutex_t *  mutex)
inlinestatic

Definition at line 377 of file dtpthread.h.

References mutex.

Referenced by dt_iop_gui_leave_critical_section(), and dt_opencl_release_device().

◆ dt_pthread_mutex_destroy()

◆ dt_pthread_mutex_init()

static int dt_pthread_mutex_init ( dt_pthread_mutex_t *  mutex,
const pthread_mutexattr_t *  mutexattr 
)
inlinestatic

Initialise a mutex. With mutexattr NULL – which is how 54 of the 56 call sites in this tree spell it – the mutex is RECURSIVE.

A thread re-entering a lock it already holds cannot race itself: while it holds the lock no other thread is inside the critical section, so the data it protects is as safe at depth 2 as at depth 1. What a non-recursive mutex does in that situation is deadlock – turning a harmless nesting into a frozen application, which is a worse outcome than the thing it is meant to prevent.

The codebase had already reached that conclusion one lock at a time: darktable.c makes the exiv2 mutex recursive so "a public exif function can hold it across its whole critical section while inner helpers or re-entrant calls re-lock it without deadlocking." This makes it the default instead of a per-lock rediscovery.

Parameters
mutexthe mutex to initialise.
mutexattrNULL for the recursive default, or an explicit attribute to override it.
Warning
Recursion is NOT free of consequence, and there is exactly one place it bites: pthread_cond_wait() releases the mutex ONCE. A thread that waits while holding a recursive mutex at depth > 1 therefore never releases it and the wait cannot be signalled – POSIX calls the combination undefined. At depth 1 it behaves exactly as before. The eight cond-wait sites in this tree all take their mutex once at the top of a wait loop; see dt_pthread_cond_wait() below, which repeats this where it would be noticed.
Note
Recursion also hides a real class of bug that a deadlock would have exposed: a function that breaks an invariant, then calls something that re-enters and reads the half-updated state. That trade is deliberate – a rare, quiet correctness risk in place of a frequent, total hang.

Definition at line 104 of file dtpthread.h.

References mutex, and res.

Referenced by _a_null_attr_mutex_is_recursive(), _an_explicit_attribute_is_honoured(), _dt_delete_file_display_modal_dialog(), _filename_lock_init(), _history_stmt_mutex_ensure(), _image_stmt_mutex_ensure(), _init(), _iop_gui_alloc(), _rsvg_lock_init(), _rt_init_state(), _settings_lock_ensure(), _styles_stmt_mutex_ensure(), _the_blocking_lock_also_re_enters(), dt_accels_init(), dt_cache_arena_init(), dt_cache_init(), dt_conf_init(), dt_control_init(), dt_control_job_create(), dt_control_progress_create(), dt_database_open(), dt_database_set_settings(), dt_dev_init(), dt_dev_pixelpipe_cache_init(), dt_dev_pixelpipe_init_cached(), dt_dev_snapshot_capture(), dt_drawlayer_runtime_manager_init(), dt_film_init(), dt_folder_survey_init(), dt_gui_gtk_init(), dt_gui_throttle_init(), dt_import_init(), dt_init(), dt_iop_gui_init_blending(), dt_nn_model_load(), dt_opencl_device_init(), dt_opencl_init(), dt_pixel_cache_new_entry(), dt_supervisor_init(), dt_thumbnail_new(), dt_thumbtable_new(), dt_undo_init(), dt_view_image_surface_fetcher_init(), init(), and init_global().

◆ dt_pthread_mutex_lock()

static int dt_pthread_mutex_lock ( dt_pthread_mutex_t *  mutex)
inlinestatic

Definition at line 117 of file dtpthread.h.

References mutex.

Referenced by _a_null_attr_mutex_is_recursive(), _accels_tooltip_query_hook(), _alternative_mode(), _an_explicit_attribute_is_honoured(), _arena_alloc_with_defrag(), _backend_worker_on_idle(), _backend_worker_process_stroke_end(), _blendop_blendif_channel_display_toggled(), _blendop_blendif_channel_mask_view_toggle(), _blendop_blendif_enter(), _blendop_blendif_leave(), _blendop_blendif_leave_delayed(), _blendop_blendif_sliders_callback(), _blendop_blendif_update_tab(), _cache_entry_clmem_flush_device(), _cache_entry_clmem_flush_host_pinned_locked(), _cache_entry_clmem_has_host_pinned_locked(), _cache_entry_materialize_host_data_locked(), _cache_lookup_existing(), _cache_try_rekey_reuse_locked(), _cache_try_restore_device_payload(), _cancel_async_commit(), _cleanup(), _drawlayer_worker_main(), _dt_collection_lut(), _dt_ctl_log_message_timeout_callback(), _dt_ctl_toast_message_timeout_callback(), _dt_delete_dialog_main_thread(), _dt_delete_file_display_modal_dialog(), _dt_image_info_changed_callback(), _dt_thumbtable_empty_list(), _enqueue_event(), _enqueue_input(), _filelist_changed_callback(), _find_non_virtual_shortcut(), _find_path_for_keys(), _finish_buffer_thread(), _folder_survey_deactivate(), _folder_survey_imported(), _folder_survey_job_cleanup(), _folder_survey_job_run(), _folder_survey_offer_pending_import(), _folder_survey_reschedule(), _folder_survey_scan(), _free_cache_entry(), _get_custom_model(), _get_image_buffer(), _get_model(), _grid_handle_key(), _image_write_history_hash(), _imgid_to_rowid(), _insert_accel(), _log_push(), _mipmap_subcache_collect(), _mouse_over_image_callback(), _pause_worker(), _pixel_cache_clmem_get(), _pixel_cache_clmem_put(), _pixel_cache_clmem_remove(), _pressure_wake(), _recompute_job_run(), _refresh_highlights(), _resume_worker(), _resync_pipe_with_history(), _rt_workers_active(), _rt_workers_any_active(), _scan_still_valid(), _schedule_main_recompute(), _settings_get(), _step_state(), _stop_worker(), _studio_dev_teardown(), _sync_main_now(), _system_memory_pressure_valve(), _the_blocking_lock_also_re_enters(), _thumb_draw_image(), _thumb_job_state_changed(), _thumbtable_clone_lut(), _thumbtable_drag_set_icon(), _toast_log(), _ui_log_redraw_callback(), _ui_toast_redraw_callback(), _update_manager_information(), _view_surface_commit_main(), _view_surface_fetch_job_run(), _wait_worker_idle(), _weights_cl(), auto_advance(), dt_accels_cleanup(), dt_accels_connect_accels(), dt_accels_new_action_shortcut(), dt_accels_new_virtual_instance_shortcut(), dt_accels_new_virtual_shortcut(), dt_accels_new_widget_shortcut(), dt_accels_remove_accel(), dt_accels_remove_shortcut(), dt_cache_arena_alloc(), dt_cache_arena_cleanup(), dt_cache_arena_free(), dt_cache_arena_stats(), dt_cache_arena_trim(), dt_cache_contains(), dt_cache_for_all(), dt_cache_get_with_caller(), dt_cache_remove(), dt_cache_seed(), dt_cache_testget(), dt_capabilities_add(), dt_capabilities_remove(), dt_conf_all_string_entries(), dt_conf_get_string(), dt_conf_get_var(), dt_conf_key_exists(), dt_conf_set_if_not_overridden(), dt_control_add_job(), dt_control_add_job_res(), dt_control_button_pressed(), dt_control_expose(), dt_control_flush_jobs_queue(), dt_control_get_keyboard_over_id(), dt_control_get_mouse_over_id(), dt_control_get_selected_files(), dt_control_job_get_state(), dt_control_job_set_state(), dt_control_job_wait(), dt_control_jobs_drain(), dt_control_jobs_init(), dt_control_log(), dt_control_log_busy_enter(), dt_control_log_busy_leave(), dt_control_progress_cancel(), dt_control_progress_cancellable(), dt_control_progress_create(), dt_control_progress_destroy(), dt_control_progress_get_gui_data(), dt_control_progress_get_message(), dt_control_progress_get_progress(), dt_control_progress_has_progress_bar(), dt_control_progress_make_cancellable(), dt_control_progress_set_gui_data(), dt_control_progress_set_message(), dt_control_progress_set_progress(), dt_control_quit(), dt_control_run_job(), dt_control_run_job_res(), dt_control_running(), dt_control_schedule_job(), dt_control_set_keyboard_over_id(), dt_control_set_mouse_over_id(), dt_control_shutdown(), dt_control_toast_busy_enter(), dt_control_toast_busy_leave(), dt_control_work(), dt_control_work_res(), dt_control_worker_kicker(), dt_database_get_settings(), dt_database_set_settings(), dt_dev_cleanup(), dt_dev_darkroom_pipeline(), dt_dev_pixel_pipe_cache_remove_lru(), dt_dev_pixelpipe_cache_auto_destroy_apply(), dt_dev_pixelpipe_cache_borrow_cl_payload(), dt_dev_pixelpipe_cache_flag_auto_destroy(), dt_dev_pixelpipe_cache_flush(), dt_dev_pixelpipe_cache_flush_clmem(), dt_dev_pixelpipe_cache_flush_entry_clmem(), dt_dev_pixelpipe_cache_flush_host_pinned_image(), dt_dev_pixelpipe_cache_get(), dt_dev_pixelpipe_cache_get_entries_stats(), dt_dev_pixelpipe_cache_get_entry(), dt_dev_pixelpipe_cache_get_entry_by_data(), dt_dev_pixelpipe_cache_get_pinned_image(), dt_dev_pixelpipe_cache_get_usage(), dt_dev_pixelpipe_cache_get_writable(), dt_dev_pixelpipe_cache_invalidate_hashes(), dt_dev_pixelpipe_cache_ref_count_entry(), dt_dev_pixelpipe_cache_ref_entry_by_hash(), dt_dev_pixelpipe_cache_ref_entry_for_host_ptr(), dt_dev_pixelpipe_cache_ref_host_entry_by_hash(), dt_dev_pixelpipe_cache_rekey(), dt_dev_pixelpipe_cache_remove(), dt_dev_pixelpipe_cache_return_cl_payload(), dt_dev_pixelpipe_cache_unref_hash(), dt_dev_pixelpipe_process(), dt_dev_snapshot_clear(), dt_dev_snapshot_draw(), dt_dev_transient_params_active(), dt_dev_transient_params_clear(), dt_dev_transient_params_get(), dt_dev_transient_params_set(), dt_drawlayer_runtime_manager_note_buffer_lock(), dt_drawlayer_runtime_manager_note_sidecar_io(), dt_drawlayer_runtime_manager_note_thread(), dt_drawlayer_worker_get_snapshot(), dt_drawlayer_worker_pending_dab_count(), dt_drawlayer_worker_request_commit(), dt_drawlayer_worker_reset_backend_path(), dt_drawlayer_worker_reset_live_publish(), dt_drawlayer_worker_reset_stroke(), dt_film_import1_create(), dt_film_import1_run(), dt_folder_survey_absorb_new_files(), dt_folder_survey_cleanup(), dt_folder_survey_count_new_files(), dt_folder_survey_forget_session(), dt_folder_survey_halt(), dt_folder_survey_init(), dt_folder_survey_is_active(), dt_folder_survey_start(), dt_folder_survey_stop(), dt_get_main_message_copy(), dt_get_selected_files(), dt_gui_gtk_write_config(), dt_gui_throttle_record_runtime(), dt_history_repository_cleanup(), dt_history_repository_count_items(), dt_history_repository_delete_history(), dt_history_repository_delete_masks_history(), dt_history_repository_foreach_auto_preset_row(), dt_history_repository_foreach_row(), dt_history_repository_get_autoapply_ioporder_params(), dt_history_repository_get_end(), dt_history_repository_get_module_order(), dt_history_repository_get_module_order_version(), dt_history_repository_get_next_num(), dt_history_repository_module_exists(), dt_history_repository_set_end(), dt_history_repository_set_module_order(), dt_history_repository_shift_nums(), dt_history_repository_write_item(), dt_image_cache_get_entries_stats(), dt_image_cache_get_usage(), dt_image_repository_get_write_timestamp(), dt_image_repository_load(), dt_image_repository_set_flags(), dt_image_repository_set_flags_masked(), dt_image_repository_touch_write_timestamp(), dt_import_cleanup(), dt_import_init(), dt_iop_gui_blending_lose_focus(), dt_iop_gui_cleanup_blending(), dt_iop_gui_cleanup_blending_body(), dt_iop_gui_init_blending(), dt_iop_gui_update_blendif(), dt_masks_get_lock_mode(), dt_masks_set_lock_mode(), dt_mipmap_cache_set_settings(), dt_opencl_apply_scheduling_profile(), dt_opencl_create_kernel(), dt_opencl_free_kernel(), dt_opencl_memory_statistics(), dt_opencl_reserve_device_for_pipe(), dt_pixelpipe_cache_alloc_align_cache_impl(), dt_pixelpipe_cache_free_align_cache(), dt_pixelpipe_cache_get_largest_free_run(), dt_pixelpipe_cache_wait_cancel(), dt_pixelpipe_cache_wait_enqueue(), dt_pixelpipe_cache_wait_foreach_pending(), dt_pixelpipe_cache_wait_get_stats(), dt_pixelpipe_cache_wait_pending_count(), dt_pixelpipe_cache_wait_take_matching(), dt_set_main_message(), dt_style_repository_cleanup(), dt_style_repository_foreach_apply_item(), dt_style_repository_foreach_style(), dt_supervisor_backbuf(), dt_supervisor_cache_wait(), dt_supervisor_cacheline_create(), dt_supervisor_cacheline_delete(), dt_supervisor_cacheline_read(), dt_supervisor_cleanup(), dt_supervisor_describe(), dt_supervisor_events_clear(), dt_supervisor_events_count(), dt_supervisor_events_snapshot(), dt_supervisor_events_snapshot_since(), dt_supervisor_form(), dt_supervisor_history(), dt_supervisor_image(), dt_supervisor_mipmap(), dt_supervisor_node(), dt_supervisor_rekey(), dt_supervisor_thumbnail(), dt_supervisor_widget(), dt_thumbnail_destroy(), dt_thumbnail_get_image_buffer(), dt_thumbnail_image_refresh_real(), dt_thumbtable_dispatch_over(), dt_thumbtable_get_thumbnail_info(), dt_thumbtable_key_pressed_grid(), dt_thumbtable_move_in_grid(), dt_thumbtable_offset_zoom(), dt_thumbtable_refresh_thumbnail_real(), dt_thumbtable_scroll_to_imgid(), dt_thumbtable_select_all(), dt_thumbtable_select_range(), dt_thumbtable_set_draw_group_borders(), dt_thumbtable_set_overlays_mode(), dt_thumbtable_stop(), dt_thumbtable_update(), dt_view_image_get_surface_async(), dt_view_image_surface_fetcher_cleanup(), dt_view_image_surface_fetcher_invalidate(), enter(), expose(), gui_cleanup(), gui_cleanup(), gui_init(), leave(), process(), and store().

◆ dt_pthread_mutex_trylock()

◆ dt_pthread_mutex_unlock()

static int dt_pthread_mutex_unlock ( dt_pthread_mutex_t *  mutex)
inlinestatic

Definition at line 127 of file dtpthread.h.

References mutex.

Referenced by _a_null_attr_mutex_is_recursive(), _accels_tooltip_query_hook(), _alternative_mode(), _an_explicit_attribute_is_honoured(), _arena_alloc_with_defrag(), _backend_worker_on_idle(), _backend_worker_process_stroke_end(), _blendop_blendif_channel_display_toggled(), _blendop_blendif_channel_mask_view_toggle(), _blendop_blendif_enter(), _blendop_blendif_leave(), _blendop_blendif_leave_delayed(), _blendop_blendif_sliders_callback(), _blendop_blendif_update_tab(), _cache_entry_clmem_flush_device(), _cache_entry_clmem_flush_host_pinned_locked(), _cache_entry_clmem_has_host_pinned_locked(), _cache_entry_materialize_host_data_locked(), _cache_lookup_existing(), _cache_try_rekey_reuse_locked(), _cache_try_restore_device_payload(), _cancel_async_commit(), _cleanup(), _drawlayer_worker_main(), _dt_collection_lut(), _dt_ctl_log_message_timeout_callback(), _dt_ctl_toast_message_timeout_callback(), _dt_delete_dialog_main_thread(), _dt_delete_file_display_modal_dialog(), _dt_image_info_changed_callback(), _dt_thumbtable_empty_list(), _enqueue_event(), _enqueue_input(), _filelist_changed_callback(), _find_non_virtual_shortcut(), _find_path_for_keys(), _finish_buffer_thread(), _folder_survey_deactivate(), _folder_survey_imported(), _folder_survey_job_cleanup(), _folder_survey_job_run(), _folder_survey_offer_pending_import(), _folder_survey_reschedule(), _folder_survey_scan(), _free_cache_entry(), _get_custom_model(), _get_image_buffer(), _get_model(), _grid_handle_key(), _image_write_history_hash(), _imgid_to_rowid(), _insert_accel(), _log_push(), _memory_pressure_shedder(), _mipmap_subcache_collect(), _mouse_over_image_callback(), _pause_worker(), _pixel_cache_clmem_get(), _pixel_cache_clmem_put(), _pixel_cache_clmem_remove(), _pressure_wake(), _recompute_job_run(), _refresh_highlights(), _resume_worker(), _resync_pipe_with_history(), _rt_workers_active(), _rt_workers_any_active(), _scan_still_valid(), _schedule_main_recompute(), _settings_get(), _step_state(), _stop_worker(), _studio_dev_teardown(), _sync_main_now(), _system_memory_pressure_valve(), _the_blocking_lock_also_re_enters(), _thumb_draw_image(), _thumb_job_state_changed(), _thumbtable_clone_lut(), _thumbtable_drag_set_icon(), _toast_log(), _ui_log_redraw_callback(), _ui_toast_redraw_callback(), _update_manager_information(), _view_surface_commit_main(), _view_surface_fetch_job_run(), _wait_worker_idle(), _weights_cl(), auto_advance(), dt_accels_cleanup(), dt_accels_connect_accels(), dt_accels_new_action_shortcut(), dt_accels_new_virtual_instance_shortcut(), dt_accels_new_virtual_shortcut(), dt_accels_new_widget_shortcut(), dt_accels_remove_accel(), dt_accels_remove_shortcut(), dt_cache_arena_alloc(), dt_cache_arena_cleanup(), dt_cache_arena_free(), dt_cache_arena_stats(), dt_cache_arena_trim(), dt_cache_contains(), dt_cache_for_all(), dt_cache_get_with_caller(), dt_cache_remove(), dt_cache_seed(), dt_cache_testget(), dt_capabilities_add(), dt_capabilities_remove(), dt_conf_all_string_entries(), dt_conf_get_string(), dt_conf_get_var(), dt_conf_key_exists(), dt_conf_set_if_not_overridden(), dt_control_add_job(), dt_control_add_job_res(), dt_control_button_pressed(), dt_control_expose(), dt_control_flush_jobs_queue(), dt_control_get_keyboard_over_id(), dt_control_get_mouse_over_id(), dt_control_get_selected_files(), dt_control_job_get_state(), dt_control_job_set_state(), dt_control_job_wait(), dt_control_jobs_drain(), dt_control_jobs_init(), dt_control_log(), dt_control_log_busy_enter(), dt_control_log_busy_leave(), dt_control_progress_cancel(), dt_control_progress_cancellable(), dt_control_progress_create(), dt_control_progress_destroy(), dt_control_progress_get_gui_data(), dt_control_progress_get_message(), dt_control_progress_get_progress(), dt_control_progress_has_progress_bar(), dt_control_progress_make_cancellable(), dt_control_progress_set_gui_data(), dt_control_progress_set_message(), dt_control_progress_set_progress(), dt_control_quit(), dt_control_run_job(), dt_control_run_job_res(), dt_control_running(), dt_control_schedule_job(), dt_control_set_keyboard_over_id(), dt_control_set_mouse_over_id(), dt_control_shutdown(), dt_control_toast_busy_enter(), dt_control_toast_busy_leave(), dt_control_work(), dt_control_work_res(), dt_control_worker_kicker(), dt_database_get_settings(), dt_database_set_settings(), dt_dev_cleanup(), dt_dev_darkroom_pipeline(), dt_dev_pixel_pipe_cache_remove_lru(), dt_dev_pixelpipe_cache_auto_destroy_apply(), dt_dev_pixelpipe_cache_borrow_cl_payload(), dt_dev_pixelpipe_cache_flag_auto_destroy(), dt_dev_pixelpipe_cache_flush(), dt_dev_pixelpipe_cache_flush_clmem(), dt_dev_pixelpipe_cache_flush_entry_clmem(), dt_dev_pixelpipe_cache_flush_host_pinned_image(), dt_dev_pixelpipe_cache_flush_old(), dt_dev_pixelpipe_cache_get(), dt_dev_pixelpipe_cache_get_entries_stats(), dt_dev_pixelpipe_cache_get_entry(), dt_dev_pixelpipe_cache_get_entry_by_data(), dt_dev_pixelpipe_cache_get_pinned_image(), dt_dev_pixelpipe_cache_get_usage(), dt_dev_pixelpipe_cache_get_writable(), dt_dev_pixelpipe_cache_invalidate_hashes(), dt_dev_pixelpipe_cache_ref_count_entry(), dt_dev_pixelpipe_cache_ref_entry_by_hash(), dt_dev_pixelpipe_cache_ref_entry_for_host_ptr(), dt_dev_pixelpipe_cache_ref_host_entry_by_hash(), dt_dev_pixelpipe_cache_rekey(), dt_dev_pixelpipe_cache_remove(), dt_dev_pixelpipe_cache_return_cl_payload(), dt_dev_pixelpipe_cache_unref_hash(), dt_dev_pixelpipe_process(), dt_dev_snapshot_clear(), dt_dev_snapshot_draw(), dt_dev_transient_params_active(), dt_dev_transient_params_clear(), dt_dev_transient_params_get(), dt_dev_transient_params_set(), dt_drawlayer_runtime_manager_note_buffer_lock(), dt_drawlayer_runtime_manager_note_sidecar_io(), dt_drawlayer_runtime_manager_note_thread(), dt_drawlayer_worker_get_snapshot(), dt_drawlayer_worker_pending_dab_count(), dt_drawlayer_worker_request_commit(), dt_drawlayer_worker_reset_backend_path(), dt_drawlayer_worker_reset_live_publish(), dt_drawlayer_worker_reset_stroke(), dt_film_import1_create(), dt_film_import1_run(), dt_folder_survey_absorb_new_files(), dt_folder_survey_cleanup(), dt_folder_survey_count_new_files(), dt_folder_survey_forget_session(), dt_folder_survey_halt(), dt_folder_survey_init(), dt_folder_survey_is_active(), dt_folder_survey_start(), dt_folder_survey_stop(), dt_get_main_message_copy(), dt_get_selected_files(), dt_gui_gtk_write_config(), dt_gui_throttle_record_runtime(), dt_history_repository_cleanup(), dt_history_repository_count_items(), dt_history_repository_delete_history(), dt_history_repository_delete_masks_history(), dt_history_repository_foreach_auto_preset_row(), dt_history_repository_foreach_row(), dt_history_repository_get_autoapply_ioporder_params(), dt_history_repository_get_end(), dt_history_repository_get_module_order(), dt_history_repository_get_module_order_version(), dt_history_repository_get_next_num(), dt_history_repository_module_exists(), dt_history_repository_set_end(), dt_history_repository_set_module_order(), dt_history_repository_shift_nums(), dt_history_repository_write_item(), dt_image_cache_get_entries_stats(), dt_image_cache_get_usage(), dt_image_repository_get_write_timestamp(), dt_image_repository_load(), dt_image_repository_set_flags(), dt_image_repository_set_flags_masked(), dt_image_repository_touch_write_timestamp(), dt_import_cleanup(), dt_import_init(), dt_iop_gui_blending_lose_focus(), dt_iop_gui_cleanup_blending(), dt_iop_gui_cleanup_blending_body(), dt_iop_gui_init_blending(), dt_iop_gui_update_blendif(), dt_masks_get_lock_mode(), dt_masks_set_lock_mode(), dt_mipmap_cache_set_settings(), dt_opencl_apply_scheduling_profile(), dt_opencl_create_kernel(), dt_opencl_free_kernel(), dt_opencl_memory_statistics(), dt_opencl_reserve_device_for_pipe(), dt_pixelpipe_cache_alloc_align_cache_impl(), dt_pixelpipe_cache_free_align_cache(), dt_pixelpipe_cache_get_largest_free_run(), dt_pixelpipe_cache_wait_cancel(), dt_pixelpipe_cache_wait_count_immediate_hit(), dt_pixelpipe_cache_wait_count_miss(), dt_pixelpipe_cache_wait_enqueue(), dt_pixelpipe_cache_wait_foreach_pending(), dt_pixelpipe_cache_wait_get_stats(), dt_pixelpipe_cache_wait_pending_count(), dt_pixelpipe_cache_wait_take_matching(), dt_set_main_message(), dt_style_repository_cleanup(), dt_style_repository_foreach_apply_item(), dt_style_repository_foreach_style(), dt_supervisor_backbuf(), dt_supervisor_cache_wait(), dt_supervisor_cacheline_create(), dt_supervisor_cacheline_delete(), dt_supervisor_cacheline_read(), dt_supervisor_cleanup(), dt_supervisor_describe(), dt_supervisor_events_clear(), dt_supervisor_events_count(), dt_supervisor_events_snapshot(), dt_supervisor_events_snapshot_since(), dt_supervisor_form(), dt_supervisor_history(), dt_supervisor_image(), dt_supervisor_mipmap(), dt_supervisor_node(), dt_supervisor_rekey(), dt_supervisor_thumbnail(), dt_supervisor_widget(), dt_thumbnail_destroy(), dt_thumbnail_get_image_buffer(), dt_thumbnail_image_refresh_real(), dt_thumbtable_dispatch_over(), dt_thumbtable_get_thumbnail_info(), dt_thumbtable_key_pressed_grid(), dt_thumbtable_move_in_grid(), dt_thumbtable_offset_zoom(), dt_thumbtable_refresh_thumbnail_real(), dt_thumbtable_scroll_to_imgid(), dt_thumbtable_select_all(), dt_thumbtable_select_range(), dt_thumbtable_set_draw_group_borders(), dt_thumbtable_set_overlays_mode(), dt_thumbtable_stop(), dt_thumbtable_update(), dt_view_image_get_surface_async(), dt_view_image_surface_fetcher_cleanup(), dt_view_image_surface_fetcher_invalidate(), enter(), expose(), gui_cleanup(), gui_cleanup(), gui_init(), leave(), process(), and store().

◆ dt_pthread_rwlock_destroy()

static int dt_pthread_rwlock_destroy ( dt_pthread_rwlock_t *  lock)
inlinestatic

◆ dt_pthread_rwlock_init()

static int dt_pthread_rwlock_init ( dt_pthread_rwlock_t *  lock,
const pthread_rwlockattr_t *  attr 
)
inlinestatic

◆ dt_pthread_rwlock_rdlock()

◆ dt_pthread_rwlock_set_name()

static void dt_pthread_rwlock_set_name ( dt_pthread_rwlock_t *  lock,
const char *  name 
)
inlinestatic

Definition at line 207 of file dtpthread.h.

References lock, and name.

Referenced by dt_dev_init().

◆ dt_pthread_rwlock_tryrdlock()

static int dt_pthread_rwlock_tryrdlock ( dt_pthread_rwlock_t *  rwlock)
inlinestatic

◆ dt_pthread_rwlock_trywrlock()

◆ dt_pthread_rwlock_unlock()

static int dt_pthread_rwlock_unlock ( dt_pthread_rwlock_t *  rwlock)
inlinestatic

Definition at line 217 of file dtpthread.h.

References res, and rwlock.

Referenced by _a_snapshot_references_every_item_and_releases_them(), _an_rwlock_writer_may_re_enter(), _cache_get_oldest(), _cow_touch_clones_an_item_a_snapshot_is_holding(), _cow_touch_ignores_a_marker_naming_a_different_item(), _cow_touch_repoints_the_pipe_marker_and_balances_every_reference(), _dt_dev_history_compress_internal(), _dt_dev_write_history_job_run(), _for_each_remove(), _for_each_remove_old(), _history_apply_history_end(), _history_end_is_clamped_to_the_list_at_snapshot_time(), _history_show_module_for_end(), _lib_history_change_callback(), _lib_snapshot_capture_state(), _module_carries_history(), _non_thread_safe_cache_remove(), _pop_undo(), _render_surface(), _studio_dev_teardown(), commit_params(), dt_cache_gc(), dt_cache_release_with_caller(), dt_cache_remove(), dt_colorrings_apply_rgb_lut(), dt_database_close(), dt_database_end_transaction_batch(), dt_database_release_transaction_debug(), dt_database_rollback_transaction(), dt_dev_cleanup(), dt_dev_history_commit_item_now(), dt_dev_history_cow_touch(), dt_dev_history_gui_update(), dt_dev_history_notify_change(), dt_dev_history_truncate(), dt_dev_history_undo_end_record(), dt_dev_history_undo_start_record(), dt_dev_load_image(), dt_dev_masks_update_hash(), dt_dev_module_remove(), dt_dev_pixelpipe_cache_auto_destroy_apply(), dt_dev_pixelpipe_cache_flush_clmem(), dt_dev_pixelpipe_cache_peek(), dt_dev_pixelpipe_cache_rdlock_entry(), dt_dev_pixelpipe_cache_ref_host_entry_by_hash(), dt_dev_pixelpipe_cache_wrlock_entry(), dt_dev_pixelpipe_change(), dt_dev_pixelpipe_synch_all_real(), dt_dev_pixelpipe_synch_top(), dt_dev_pop_history_items(), dt_dev_reload_history_items(), dt_dev_replace_history_on_image(), dt_dev_write_history(), dt_drawlayer_commit_dabs(), dt_geometry_chain_rebuild(), dt_iop_module_instance_exists(), dt_masks_append_form(), dt_masks_change_form_gui(), dt_masks_cleanup_unused(), dt_masks_cow_touch(), dt_masks_create_ext(), dt_masks_get_from_id(), dt_masks_group_list(), dt_masks_gui_form_save_creation(), dt_masks_iop_combo_populate(), dt_masks_release_all_forms(), dt_masks_remove_form(), dt_masks_replace_current_forms(), dt_masks_snapshot_current_forms(), dt_styles_apply_style_item(), gui_focus(), gui_update(), leave(), and post_history_commit().

◆ dt_pthread_rwlock_wrlock()

◆ dt_pthread_setname()

void dt_pthread_setname ( const char *  name)

◆ if()

if ( res)

Definition at line 352 of file dtpthread.h.

References rwlock.

Variable Documentation

◆ mutex

◆ NO_THREAD_SAFETY_ANALYSIS

static int rwlock NO_THREAD_SAFETY_ANALYSIS
Initial value:
{
if(pthread_equal(rwlock->writer, pthread_self()) && rwlock->writer_depth >= 1) return EBUSY
return pthread_rwlock_tryrdlock & rwlock
Definition dtpthread.h:345

Definition at line 339 of file dtpthread.h.

◆ res

return res = pthread_rwlock_trywrlock(&rwlock->lock)

Definition at line 351 of file dtpthread.h.

Referenced by _ask_and_delete(), _ask_before_delete_style(), _choose_gpx_callback(), _colorspaces_build(), _completion_match_func(), _completion_match_func(), _confirm(), _copy_file(), _create_tag_from_entry(), _datetime_tooltip(), _delete_tagids(), _detect_printers_callback(), _dictionary_key_pressed(), _draw_image(), _draw_transient_image(), _dt_collection_compute_datetime(), _dt_opencl_get_conf_int(), _expand_exif_and_gps(), _expand_image_and_version(), _expand_rating_and_metadata(), _export_button_clicked(), _get_image_buffer(), _has_prefix(), _hm_ask_user_constraints_choice(), _hm_show_merge_report_popup(), _hm_warn_missing_raster_producers(), _image_import_internal(), _init_8(), _is_in_library_by_metadata(), _lib_location_search(), _lib_tagging_tag_key_press(), _lib_tagging_tag_redo_accel(), _load_jpg(), _main_do_event_help(), _mask_indicator_tooltip(), _masks_remove_or_delete_finish(), _menuitem_delete_preset(), _menuitem_preferences(), _menuitem_update_preset(), _metadata_view_update_values(), _new_connection(), _pop_menu_attached_attach_to_all(), _pop_menu_dictionary_delete_node(), _PQ_fct(), _print_button_clicked(), _row_tooltip_setup(), _row_tooltip_setup(), _shape_manager_get_selected(), _slideshow_request_slot(), _sort_model_func(), _tag_add_tags_to_list(), _tag_execute(), _thumb_draw_image(), _updates_worker(), _write_snapshot_data(), _write_xmp_id(), check_extension(), compare_rows_presets(), compute_curve_lut(), CurveDataSample(), CurveDataSampleV2(), CurveDataSampleV2Periodic(), delete_file_from_disk(), delete_history_callback(), do_fit(), dt_build_filename_from_pattern(), dt_cache_get_with_caller(), dt_cache_remove(), dt_cache_testget(), dt_conf_key_exists(), dt_control_add_job_res(), dt_control_copy_images(), dt_control_delete_image(), dt_control_delete_images(), dt_control_move_images(), dt_control_progress_cancellable(), dt_control_progress_get_gui_data(), dt_control_progress_get_message(), dt_control_progress_get_progress(), dt_control_progress_has_progress_bar(), dt_control_remove_images(), dt_control_run_job_res(), dt_control_save_xmps_job_run(), dt_datetime_entry_to_exif(), dt_datetime_entry_to_exif_upper_bound(), dt_datetime_exif_to_numbers(), dt_datetime_gtimespan_to_exif(), dt_datetime_gtimespan_to_local(), dt_datetime_gtimespan_to_numbers(), dt_datetime_unix_to_exif(), dt_dev_load_modules(), dt_dev_pixelpipe_init(), dt_dev_pixelpipe_init_dummy(), dt_dev_pixelpipe_init_export(), dt_dev_pixelpipe_init_preview(), dt_dev_pixelpipe_init_thumbnail(), dt_develop_blend_legacy_params_from_so(), dt_draw_curve_calc_values(), dt_draw_curve_calc_values_V2(), dt_draw_curve_calc_values_V2_nonperiodic(), dt_draw_curve_calc_values_V2_periodic(), dt_draw_curve_smaple_values(), dt_exif_read(), dt_exif_read_blob(), dt_exif_read_from_blob(), dt_focus_draw_clusters(), dt_get_system_gui_ppd(), dt_gui_hist_dialog_new(), dt_gui_merge_options_dialog(), dt_history_paste_parts_prepare(), dt_image_write_sidecar_file(), dt_image_write_sidecar_file_forced(), dt_image_xmp_mode_refresh_from_conf(), dt_imageio_export_with_flags(), dt_imageio_jpeg_read_profile(), dt_imageio_large_thumbnail(), dt_imageio_load_modules_format(), dt_lib_presets_apply(), dt_map_location_update_images(), dt_module_load_modules(), dt_opencl_device_init(), dt_opencl_init(), dt_pdf_parse_length(), dt_pdf_parse_paper_size(), dt_pthread_mutex_init(), dt_pthread_rwlock_rdlock(), dt_pthread_rwlock_unlock(), dt_pthread_rwlock_wrlock(), dt_str_replace(), dt_tag_attach(), dt_tag_attach_images(), dt_tag_attach_string_list(), dt_tag_detach(), dt_tag_detach_images(), dt_tag_get_tag_order_by_id(), dt_tag_set_tags(), dt_util_gps_elevation_to_number(), dt_util_gps_rationale_to_number(), dt_util_gps_string_to_number(), expose(), expose(), get_export_filename(), guided_filter_tiling(), icuCollationColl(), icuRegexpFunc(), main(), main(), main(), menuitem_delete_preset(), menuitem_update_preset(), motion_notify_callback_reference(), motion_notify_callback_source(), open_cht(), open_it8(), open_reference_image(), open_source_image(), rt_masks_get_delta_to_destination(), rt_masks_point_calc_delta(), set_params(), statvfs(), wmain(), and write_image().

◆ rwlock