comparison src/os/unix/ngx_atomic.h @ 425:bd39260a1383

nginx-0.0.10-2004-09-14-19:55:24 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 14 Sep 2004 15:55:24 +0000
parents 018569a8f09c
children 5e73d0ea4dab
comparison
equal deleted inserted replaced
424:84c527908237 425:bd39260a1383
66 66
67 return res; 67 return res;
68 } 68 }
69 69
70 70
71 #elif ( __sparc__ )
72
73 typedef volatile uint32_t ngx_atomic_t;
74
75
76 static ngx_inline uint32_t ngx_atomic_inc(ngx_atomic_t *value)
77 {
78 uint32_t old, new, res;
79
80 old = *value;
81
82 for ( ;; ) {
83
84 new = old + 1;
85 res = new;
86
87 __asm__ volatile (
88
89 "casa [%1]ASI_P, %2, %0"
90
91 : "+r" (res) : "r" (value), "r" (old));
92
93 if (res == old) {
94 return new;
95 }
96
97 old = res;
98 }
99 }
100
101
102 /* STUB */
103 #define ngx_atomic_dec(x) (*(x))--;
104 /**/
105
106
107 static ngx_inline uint32_t ngx_atomic_cmp_set(ngx_atomic_t *lock,
108 ngx_atomic_t old,
109 ngx_atomic_t set)
110 {
111 uint32_t res = (u_int32_t) set;
112
113 __asm__ volatile (
114
115 "casa [%1]ASI_P, %2, %0"
116
117 : "+r" (res) : "r" (lock), "r" (old));
118
119 return (res == old);
120 }
121
71 #else 122 #else
72 123
73 typedef volatile uint32_t ngx_atomic_t; 124 typedef volatile uint32_t ngx_atomic_t;
74 125
75 /* STUB */ 126 /* STUB */