Mercurial > hg > nginx-ranges
comparison src/os/unix/ngx_atomic.h @ 120:e85dca77c46a NGINX_0_3_7
nginx 0.3.7
*) Feature: the "access_log" supports the "buffer=" parameter.
*) Bugfix: nginx could not be built on platforms different from i386,
amd64, sparc и ppc; bug appeared in 0.3.2.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Thu, 27 Oct 2005 00:00:00 +0400 |
parents | 408f195b3482 |
children | 73e8476f9142 |
comparison
equal
deleted
inserted
replaced
119:85abc07cafba | 120:e85dca77c46a |
---|---|
152 | 152 |
153 static ngx_inline ngx_atomic_uint_t | 153 static ngx_inline ngx_atomic_uint_t |
154 ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old, | 154 ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old, |
155 ngx_atomic_uint_t set) | 155 ngx_atomic_uint_t set) |
156 { | 156 { |
157 if (*lock == old { | 157 if (*lock == old) { |
158 *lock = set; | 158 *lock = set; |
159 return 1; | 159 return 1; |
160 } | 160 } |
161 | 161 |
162 return 0; | 162 return 0; |
172 *value += add; | 172 *value += add; |
173 | 173 |
174 return old; | 174 return old; |
175 } | 175 } |
176 | 176 |
177 #define ngx_memory_barrier() | |
178 | |
177 #endif | 179 #endif |
178 | |
179 | 180 |
180 void ngx_spinlock(ngx_atomic_t *lock, ngx_uint_t spin); | 181 void ngx_spinlock(ngx_atomic_t *lock, ngx_uint_t spin); |
181 | 182 |
182 #define ngx_trylock(lock) (*(lock) == 0 && ngx_atomic_cmp_set(lock, 0, 1)) | 183 #define ngx_trylock(lock) (*(lock) == 0 && ngx_atomic_cmp_set(lock, 0, 1)) |
183 #define ngx_unlock(lock) *(lock) = 0 | 184 #define ngx_unlock(lock) *(lock) = 0 |