diff options
author | Igor Sysoev <igor@sysoev.ru> | 2004-03-30 20:31:58 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2004-03-30 20:31:58 +0000 |
commit | a741f8d0216d95a7ee0fbb8a24947de8842900c0 (patch) | |
tree | 39b3665a5cb0f7780a139eeea918316342fd92af /src/core/ngx_atomic.h | |
parent | 6707ba90729c615ffa5bf5ea81b8d32c3d8bd6e4 (diff) | |
download | nginx-a741f8d0216d95a7ee0fbb8a24947de8842900c0.tar.gz nginx-a741f8d0216d95a7ee0fbb8a24947de8842900c0.zip |
nginx-0.0.3-2004-03-31-00:31:58 import
Diffstat (limited to 'src/core/ngx_atomic.h')
-rw-r--r-- | src/core/ngx_atomic.h | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/core/ngx_atomic.h b/src/core/ngx_atomic.h index 31bf94c45..b95e4cc46 100644 --- a/src/core/ngx_atomic.h +++ b/src/core/ngx_atomic.h @@ -11,7 +11,7 @@ typedef volatile uint32_t ngx_atomic_t; #if (NGX_SMP) -#define NGX_SMP_LOCK "lock" +#define NGX_SMP_LOCK "lock;" #else #define NGX_SMP_LOCK #endif @@ -21,14 +21,12 @@ static ngx_inline uint32_t ngx_atomic_inc(ngx_atomic_t *value) { uint32_t old; - old = 1; - __asm__ volatile ( NGX_SMP_LOCK - " xaddl %0, %1; " + " xaddl %0, %2; " - : "+q" (old) : "m" (*value)); + : "=q" (old) : "0" (1), "m" (*value)); return old; } @@ -38,14 +36,12 @@ static ngx_inline uint32_t ngx_atomic_dec(ngx_atomic_t *value) { uint32_t old; - old = (uint32_t) -1; - __asm__ volatile ( NGX_SMP_LOCK " xaddl %0, %1; " - : "+q" (old) : "m" (*value)); + : "=q" (old) : "0" (-1), "m" (*value)); return old; } |