ObjFW  Diff

Differences From Artifact [06ac7a3e57]:

To Artifact [07554058fd]:


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
10
11
12
13
14
15
16


17
18
19
20
21
22
23







-
-







 *
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

OF_ASSUME_NONNULL_BEGIN

static OF_INLINE int
of_atomic_int_add(volatile int *_Nonnull p, int i)
{
	return __atomic_add_fetch(p, i, __ATOMIC_RELAXED);
}

static OF_INLINE int32_t
131
132
133
134
135
136
137
138

139
140
141
142
143
144

145
146

147
148
149
150

151
152

153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
129
130
131
132
133
134
135

136
137
138
139
140
141

142
143

144
145
146
147

148
149

150
151





















-
+





-
+

-
+



-
+

-
+

-
-
-
-
-
-
-
-
-
-
-
-
-
-
    void *_Nullable o, void *_Nullable n)
{
	return __atomic_compare_exchange(p, &o, &n, false,
	    __ATOMIC_RELAXED, __ATOMIC_RELAXED);
}

static OF_INLINE void
of_memory_barrier_sync(void)
of_memory_barrier_full(void)
{
	__atomic_thread_fence(__ATOMIC_SEQ_CST);
}

static OF_INLINE void
of_memory_barrier_enter(void)
of_memory_barrier_acquire(void)
{
	__atomic_thread_fence(__ATOMIC_SEQ_CST);
	__atomic_thread_fence(__ATOMIC_ACQUIRE);
}

static OF_INLINE void
of_memory_barrier_exit(void)
of_memory_barrier_release(void)
{
	__atomic_thread_fence(__ATOMIC_SEQ_CST);
	__atomic_thread_fence(__ATOMIC_RELEASE);
}

static OF_INLINE void
of_memory_barrier_producer(void)
{
	__atomic_thread_fence(__ATOMIC_SEQ_CST);
}

static OF_INLINE void
of_memory_barrier_consumer(void)
{
	__atomic_thread_fence(__ATOMIC_SEQ_CST);
}

OF_ASSUME_NONNULL_END