diff options
author | Igor Sysoev <igor@sysoev.ru> | 2004-03-31 15:26:46 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2004-03-31 15:26:46 +0000 |
commit | 709405b7559d3abcb90b61368c7072fb774f661b (patch) | |
tree | b6603153b1f77014711eff77d0d280d078d233cc /src/core/ngx_atomic.h | |
parent | a741f8d0216d95a7ee0fbb8a24947de8842900c0 (diff) | |
download | nginx-709405b7559d3abcb90b61368c7072fb774f661b.tar.gz nginx-709405b7559d3abcb90b61368c7072fb774f661b.zip |
nginx-0.0.3-2004-03-31-19:26:46 import
Diffstat (limited to 'src/core/ngx_atomic.h')
-rw-r--r-- | src/core/ngx_atomic.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/ngx_atomic.h b/src/core/ngx_atomic.h index b95e4cc46..0ec5a8722 100644 --- a/src/core/ngx_atomic.h +++ b/src/core/ngx_atomic.h @@ -25,6 +25,7 @@ static ngx_inline uint32_t ngx_atomic_inc(ngx_atomic_t *value) NGX_SMP_LOCK " xaddl %0, %2; " + " incl %0; " : "=q" (old) : "0" (1), "m" (*value)); @@ -40,6 +41,7 @@ static ngx_inline uint32_t ngx_atomic_dec(ngx_atomic_t *value) NGX_SMP_LOCK " xaddl %0, %1; " + " decl %0; " : "=q" (old) : "0" (-1), "m" (*value)); @@ -65,6 +67,15 @@ static ngx_inline uint32_t ngx_atomic_cmp_set(ngx_atomic_t *lock, return res; } + +#elif (WIN32) + +#define ngx_atomic_inc(x) InterlockedIncrement +#define ngx_atomic_dec(x) InterlockedDecrement +#define ngx_atomic_cmp_set(lock, old, set) \ + InterlockedCompareExchange(lock, set, old) + + #else typedef volatile uint32_t ngx_atomic_t; |