Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
pixelpipe_cache_wait.h
Go to the documentation of this file.
1/*
2 This file is part of Ansel.
3 Copyright (C) 2026 Aurélien Pierre.
4
5 Ansel is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Ansel is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with Ansel. If not, see <http://www.gnu.org/licenses/>.
17*/
18
42#ifndef DT_CACHES_PIXELPIPE_CACHE_WAIT_H
43#define DT_CACHES_PIXELPIPE_CACHE_WAIT_H
44
45#include <glib.h>
46#include <stdint.h>
47
48#include "system/dtpthread.h"
49
51typedef void (*dt_pixelpipe_cache_ready_callback_t)(gpointer user_data);
52
60{
61 /* Identity only, never dereferenced: which pipe and which module this waiter is about, so a
62 * re-request can be recognised as the same one and a teardown can cancel by owner. The queue
63 * outlives neither object, which is why the labels below are copies rather than reads. */
64 const void *pipe;
65 const void *module;
66
67 /* Captured when the wait is queued, for debug traces and telemetry keys. */
68 char module_op[20];
71 int32_t pipe_imgid;
72
74
80
82 gpointer user_data;
83 const char *owner_tag;
84 gpointer owner_object;
86 gboolean connected;
88
97
109 gboolean *drained);
110
118
121
124 uint64_t *immediate_hits, uint64_t *misses);
125
128
131
137 int64_t age_us, gpointer user_data);
139 gpointer user_data);
140
141#endif // DT_CACHES_PIXELPIPE_CACHE_WAIT_H
142
143// clang-format off
144// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
145// vim: shiftwidth=2 expandtab tabstop=2 cindent
146// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
147// clang-format on
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
void(* dt_pixelpipe_cache_wait_visitor_t)(const dt_pixelpipe_cache_wait_t *wait, int64_t age_us, gpointer user_data)
Walk the outstanding requests. callback is invoked under the queue lock, so it must not re-enter this...
guint dt_pixelpipe_cache_wait_pending_count(void)
How many requests are outstanding. Diagnostics only.
void dt_pixelpipe_cache_wait_foreach_pending(dt_pixelpipe_cache_wait_visitor_t callback, gpointer user_data)
gboolean dt_pixelpipe_cache_wait_cancel(dt_pixelpipe_cache_wait_t *wait, gboolean *drained)
Remove wait from the queue if it is there, and reset it to an inert state.
void(* dt_pixelpipe_cache_ready_callback_t)(gpointer user_data)
Called when the awaited cacheline finally exists. Runs on the caller's thread.
GList * dt_pixelpipe_cache_wait_take_matching(uint64_t hash, uint64_t producer_node_key, gboolean *drained)
Take every waiter satisfied by a publication of hash from node producer_node_key.
gboolean dt_pixelpipe_cache_wait_enqueue(dt_pixelpipe_cache_wait_t *wait)
Queue wait, or refresh it in place if it is already queued for the same target.
void dt_pixelpipe_cache_wait_count_immediate_hit(void)
Count one cache hit that never needed to queue.
void dt_pixelpipe_cache_wait_get_stats(uint64_t *queued, uint64_t *served, uint64_t *cancelled, uint64_t *immediate_hits, uint64_t *misses)
Snapshot of the lifetime counters, for the dump. Any pointer may be NULL.
void dt_pixelpipe_cache_wait_count_miss(void)
Count one miss that is about to queue.
unsigned __int64 uint64_t
Definition strptime.c:75
One consumer's outstanding request, owned by that consumer, not by the queue.
dt_pixelpipe_cache_ready_callback_t restart
const void *char module_op[20]