diff options
author | Igor Sysoev <igor@sysoev.ru> | 2004-03-29 17:43:58 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2004-03-29 17:43:58 +0000 |
commit | 11dbe97ca401221313dc233aa2d6f67dfcaef1a7 (patch) | |
tree | fcd53429592c68f6fdf8d3ad4b0c151b9ebd5ff3 /src/core/ngx_atomic.h | |
parent | 14f02ed0dde2ee19da75cd836daf76505d7f2e9c (diff) | |
download | nginx-11dbe97ca401221313dc233aa2d6f67dfcaef1a7.tar.gz nginx-11dbe97ca401221313dc233aa2d6f67dfcaef1a7.zip |
nginx-0.0.3-2004-03-29-21:43:58 import
Diffstat (limited to 'src/core/ngx_atomic.h')
-rw-r--r-- | src/core/ngx_atomic.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/core/ngx_atomic.h b/src/core/ngx_atomic.h index 17362aa32..311ef8892 100644 --- a/src/core/ngx_atomic.h +++ b/src/core/ngx_atomic.h @@ -21,13 +21,14 @@ static ngx_inline uint32_t ngx_atomic_inc(ngx_atomic_t *value) { uint32_t old; + old = 1; + __asm__ volatile ( - " movl $1, %0; " NGX_SMP_LOCK " xaddl %0, %1; " - : "=a" (old) : "m" (*value)); + : "=q" (old) : "m" (*value)); return old; } @@ -37,13 +38,14 @@ static ngx_inline uint32_t ngx_atomic_dec(ngx_atomic_t *value) { uint32_t old; + old = (uint32_t) -1; + __asm__ volatile ( - " movl $-1, %0; " NGX_SMP_LOCK " xaddl %0, %1; " - : "=a" (old) : "m" (*value)); + : "=q" (old) : "m" (*value)); return old; } @@ -62,7 +64,7 @@ static ngx_inline uint32_t ngx_atomic_cmp_set(ngx_atomic_t *lock, " setz %%al; " " movzbl %%al, %0; " - : "=a" (res) : "m" (*lock), "a" (old), "q" (set)); + : "+a" (res) : "m" (*lock), "a" (old), "q" (set)); return res; } |