Mercurial > hg > nginx-quic
comparison src/os/unix/ngx_atomic.h @ 6474:2cd019520210
Style.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Wed, 30 Mar 2016 11:52:16 +0300 |
parents | 4c36e15651f7 |
children | 09d15a2dbc6b |
comparison
equal
deleted
inserted
replaced
6473:9d7326d3f474 | 6474:2cd019520210 |
---|---|
274 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1) | 274 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1) |
275 | 275 |
276 | 276 |
277 static ngx_inline ngx_atomic_uint_t | 277 static ngx_inline ngx_atomic_uint_t |
278 ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old, | 278 ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old, |
279 ngx_atomic_uint_t set) | 279 ngx_atomic_uint_t set) |
280 { | 280 { |
281 if (*lock == old) { | 281 if (*lock == old) { |
282 *lock = set; | 282 *lock = set; |
283 return 1; | 283 return 1; |
284 } | 284 } |
285 | 285 |
286 return 0; | 286 return 0; |
287 } | 287 } |
288 | 288 |
289 | 289 |
290 static ngx_inline ngx_atomic_int_t | 290 static ngx_inline ngx_atomic_int_t |
291 ngx_atomic_fetch_add(ngx_atomic_t *value, ngx_atomic_int_t add) | 291 ngx_atomic_fetch_add(ngx_atomic_t *value, ngx_atomic_int_t add) |
292 { | 292 { |
293 ngx_atomic_int_t old; | 293 ngx_atomic_int_t old; |
294 | 294 |
295 old = *value; | 295 old = *value; |
296 *value += add; | 296 *value += add; |
297 | 297 |
298 return old; | 298 return old; |
299 } | 299 } |
300 | 300 |
301 #define ngx_memory_barrier() | 301 #define ngx_memory_barrier() |
302 #define ngx_cpu_pause() | 302 #define ngx_cpu_pause() |
303 | 303 |