diff src/core/ngx_atomic.h @ 301:744965ec6275

nginx-0.0.3-2004-03-31-19:26:46 import
author Igor Sysoev <igor@sysoev.ru>
date Wed, 31 Mar 2004 15:26:46 +0000
parents 502b03d9d2a3
children 1526e7686b20
line wrap: on
line diff
--- a/src/core/ngx_atomic.h
+++ b/src/core/ngx_atomic.h
@@ -25,6 +25,7 @@ static ngx_inline uint32_t ngx_atomic_in
 
         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_de
 
         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_cm
     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;