Mercurial > hg > nginx
comparison src/os/unix/ngx_atomic.h @ 571:458b6c3fea65 release-0.3.7
nginx-0.3.7-RELEASE import
*) Feature: the "access_log" supports the "buffer=" parameter.
*) Bugfix: nginx could not be built on platforms different from i386,
amd64, sparc, and ppc; the bug had appeared in 0.3.2.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 27 Oct 2005 15:46:13 +0000 |
parents | 9c2f3ed7a247 |
children | 3f8a2132b93d |
comparison
equal
deleted
inserted
replaced
570:2cdf120d8970 | 571:458b6c3fea65 |
---|---|
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 |