Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
atomic.c
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2009-2011 johannes hanika.
4 Copyright (C) 2012 Richard Wonka.
5 Copyright (C) 2016 Roman Lebedev.
6 Copyright (C) 2016 Tobias Ellinghaus.
7 Copyright (C) 2020 GrahamByrnes.
8 Copyright (C) 2020 Marco.
9 Copyright (C) 2020 parafin.
10 Copyright (C) 2020 Pascal Obry.
11 Copyright (C) 2020 Ralf Brown.
12 Copyright (C) 2022 Martin Baƙinka.
13
14 darktable is free software: you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 darktable is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with darktable. If not, see <http://www.gnu.org/licenses/>.
26*/
27
28#include "common/atomic.h"
29
30extern inline void dt_atomic_set_int(dt_atomic_int *var, int value);
31extern inline int dt_atomic_get_int(dt_atomic_int *var);
32extern inline void dt_atomic_set_uint64(dt_atomic_uint64 *var, uint64_t value);
33extern inline uint64_t dt_atomic_get_uint64(const dt_atomic_uint64 *var);
34extern inline int dt_atomic_add_int(dt_atomic_int *var, int incr);
35extern inline int dt_atomic_sub_int(dt_atomic_int *var, int decr);
36extern inline int dt_atomic_exch_int(dt_atomic_int *var, int value);
37extern inline int dt_atomic_CAS_int(dt_atomic_int *var, int *expected, int value);
38extern inline void dt_atomic_or_int(dt_atomic_int *var, int flags);
39extern inline void dt_atomic_and_int(dt_atomic_int *var, int flags);
40
41#if !defined(__STDC_NO_ATOMICS__)
42// using C11 atomics, everything is handled in the header file, so we don't need to define anything in this file
43
44#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNU_MINOR__ >= 8))
45// using GNU intrinsics. everything is handled in the header file
46
47#else
48// we fell back to using a global mutex for synchronization
49// this is that mutex's definition
50pthread_mutex_t dt_atom_mutex = PTHREAD_MUTEX_INITIALIZER;
51
52#endif // __STDC_NO_ATOMICS__
53
54// clang-format off
55// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
56// vim: shiftwidth=2 expandtab tabstop=2 cindent
57// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
58// clang-format on
void dt_atomic_set_int(dt_atomic_int *var, int value)
int dt_atomic_get_int(dt_atomic_int *var)
uint64_t dt_atomic_get_uint64(const dt_atomic_uint64 *var)
int dt_atomic_sub_int(dt_atomic_int *var, int decr)
int dt_atomic_add_int(dt_atomic_int *var, int incr)
void dt_atomic_set_uint64(dt_atomic_uint64 *var, uint64_t value)
void dt_atomic_and_int(dt_atomic_int *var, int flags)
int dt_atomic_CAS_int(dt_atomic_int *var, int *expected, int value)
int dt_atomic_exch_int(dt_atomic_int *var, int value)
void dt_atomic_or_int(dt_atomic_int *var, int flags)
atomic_int dt_atomic_int
Definition atomic.h:66
static const dt_aligned_pixel_simd_t value
Definition darktable.h:577
dt_mipmap_buffer_dsc_flags flags
Definition mipmap_cache.c:4
unsigned __int64 uint64_t
Definition strptime.c:75