Back to home page

Nginx displayed by LXR

Source navigation ]
Diff markup ]
Identifier search ]
general search ]
 
 
Version: nginx-1.15.12 ]​[ nginx-1.16.0 ]​

0001 
0002 /*
0003  * Copyright (C) Igor Sysoev
0004  * Copyright (C) Nginx, Inc.
0005  */
0006 
0007 
0008 #if (NGX_PTR_SIZE == 4)
0009 #define NGX_CASA  ngx_casa
0010 #else
0011 #define NGX_CASA  ngx_casxa
0012 #endif
0013 
0014 
0015 ngx_atomic_uint_t
0016 ngx_casa(ngx_atomic_uint_t set, ngx_atomic_uint_t old, ngx_atomic_t *lock);
0017 
0018 ngx_atomic_uint_t
0019 ngx_casxa(ngx_atomic_uint_t set, ngx_atomic_uint_t old, ngx_atomic_t *lock);
0020 
0021 /* the code in src/os/unix/ngx_sunpro_sparc64.il */
0022 
0023 
0024 static ngx_inline ngx_atomic_uint_t
0025 ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old,
0026     ngx_atomic_uint_t set)
0027 {
0028     set = NGX_CASA(set, old, lock);
0029 
0030     return (set == old);
0031 }
0032 
0033 
0034 static ngx_inline ngx_atomic_int_t
0035 ngx_atomic_fetch_add(ngx_atomic_t *value, ngx_atomic_int_t add)
0036 {
0037     ngx_atomic_uint_t  old, res;
0038 
0039     old = *value;
0040 
0041     for ( ;; ) {
0042 
0043         res = old + add;
0044 
0045         res = NGX_CASA(res, old, value);
0046 
0047         if (res == old) {
0048             return res;
0049         }
0050 
0051         old = res;
0052     }
0053 }
0054 
0055 
0056 #define ngx_memory_barrier()                                                  \
0057         __asm (".volatile");                                                  \
0058         __asm ("membar #LoadLoad | #LoadStore | #StoreStore | #StoreLoad");   \
0059         __asm (".nonvolatile")
0060 
0061 #define ngx_cpu_pause()