annotate src/os/unix/ngx_atomic.h @ 554:5c576ea5dbd9 NGINX_0_8_29

nginx 0.8.29 *) Change: now the "009" status code is written to an access log for proxied HTTP/0.9 responses. *) Feature: the "addition_types", "charset_types", "gzip_types", "ssi_types", "sub_filter_types", and "xslt_types" directives support an "*" parameter. *) Feature: GCC 4.1+ built-in atomic operations usage. Thanks to W-Mark Kubacki. *) Feature: the --with-libatomic[=DIR] option in the configure. Thanks to W-Mark Kubacki. *) Bugfix: listen unix domain socket had limited access rights. *) Bugfix: cached HTTP/0.9 responses were handled incorrectly. *) Bugfix: regular expression named captures given by "?P<...>" did not work in a "server_name" directive. Thanks to Maxim Dounin.
author Igor Sysoev <http://sysoev.ru>
date Mon, 30 Nov 2009 00:00:00 +0300
parents 4c5d2c627a6c
children 25255878df91
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
1
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
2 /*
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
3 * Copyright (C) Igor Sysoev
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
4 */
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
5
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
6
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
7 #ifndef _NGX_ATOMIC_H_INCLUDED_
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
8 #define _NGX_ATOMIC_H_INCLUDED_
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
9
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
10
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
11 #include <ngx_config.h>
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
12 #include <ngx_core.h>
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
13
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
14
554
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
15 #if (NGX_HAVE_LIBATOMIC)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
16
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
17 #include <atomic_ops.h>
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
18
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
19 #define NGX_HAVE_ATOMIC_OPS 1
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
20
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
21 typedef long ngx_atomic_int_t;
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
22 typedef AO_t ngx_atomic_uint_t;
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
23 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
24
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
25 #if (NGX_PTR_SIZE == 8)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
26 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
27 #else
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
28 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
29 #endif
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
30
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
31 #define ngx_atomic_cmp_set(lock, old, new) \
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
32 AO_compare_and_swap(lock, old, new)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
33 #define ngx_atomic_fetch_add(value, add) \
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
34 AO_fetch_and_add(value, add)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
35 #define ngx_memory_barrier() AO_nop()
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
36 #define ngx_cpu_pause()
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
37
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
38
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
39 #elif (NGX_DARWIN_ATOMIC)
270
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
40
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
41 /*
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
42 * use Darwin 8 atomic(3) and barrier(3) operations
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
43 * optimized at run-time for UP and SMP
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
44 */
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
45
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
46 #include <libkern/OSAtomic.h>
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
47
392
34fb3a573548 nginx 0.7.8
Igor Sysoev <http://sysoev.ru>
parents: 320
diff changeset
48 /* "bool" conflicts with perl's CORE/handy.h */
270
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
49 #undef bool
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
50
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
51
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
52 #define NGX_HAVE_ATOMIC_OPS 1
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
53
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
54 #if (NGX_PTR_SIZE == 8)
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
55
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
56 typedef int64_t ngx_atomic_int_t;
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
57 typedef uint64_t ngx_atomic_uint_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
58 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
270
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
59
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
60 #define ngx_atomic_cmp_set(lock, old, new) \
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
61 OSAtomicCompareAndSwap64Barrier(old, new, (int64_t *) lock)
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
62
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
63 #define ngx_atomic_fetch_add(value, add) \
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
64 (OSAtomicAdd64(add, (int64_t *) value) - add)
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
65
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
66 #else
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
67
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
68 typedef int32_t ngx_atomic_int_t;
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
69 typedef uint32_t ngx_atomic_uint_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
70 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
270
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
71
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
72 #define ngx_atomic_cmp_set(lock, old, new) \
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
73 OSAtomicCompareAndSwap32Barrier(old, new, (int32_t *) lock)
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
74
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
75 #define ngx_atomic_fetch_add(value, add) \
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
76 (OSAtomicAdd32(add, (int32_t *) value) - add)
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
77
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
78 #endif
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
79
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
80 #define ngx_memory_barrier() OSMemoryBarrier()
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
81
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
82 #define ngx_cpu_pause()
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
83
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
84 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
85
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
86
554
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
87 #elif (NGX_HAVE_GCC_ATOMIC)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
88
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
89 /* GCC 4.1 builtin atomic operations */
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
90
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
91 #define NGX_HAVE_ATOMIC_OPS 1
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
92
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
93 typedef long ngx_atomic_int_t;
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
94 typedef unsigned long ngx_atomic_uint_t;
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
95
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
96 #if (NGX_PTR_SIZE == 8)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
97 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
98 #else
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
99 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
100 #endif
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
101
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
102 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
270
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
103
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
104
554
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
105 #define ngx_atomic_cmp_set(lock, old, set) \
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
106 __sync_bool_compare_and_swap(lock, old, set)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
107
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
108 #define ngx_atomic_fetch_add(value, add) \
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
109 __sync_fetch_and_add(value, add)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
110
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
111 #define ngx_memory_barrier() __sync_synchronize()
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
112
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
113 #if ( __i386__ || __i386 || __amd64__ || __amd64 )
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
114 #define ngx_cpu_pause() __asm__ ("pause")
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
115 #else
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
116 #define ngx_cpu_pause()
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
117 #endif
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
118
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
119
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
120 #elif ( __i386__ || __i386 )
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
121
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
122 typedef int32_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
123 typedef uint32_t ngx_atomic_uint_t;
44
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
124 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
125 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
126
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
127
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
128 #if ( __SUNPRO_C )
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
129
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
130 #define NGX_HAVE_ATOMIC_OPS 1
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
131
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
132 ngx_atomic_uint_t
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
133 ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old,
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
134 ngx_atomic_uint_t set);
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
135
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
136 ngx_atomic_int_t
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
137 ngx_atomic_fetch_add(ngx_atomic_t *value, ngx_atomic_int_t add);
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
138
320
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
139 /*
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
140 * Sun Studio 12 exits with segmentation fault on '__asm ("pause")',
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
141 * so ngx_cpu_pause is declared in src/os/unix/ngx_sunpro_x86.il
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
142 */
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
143
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
144 void
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
145 ngx_cpu_pause(void);
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
146
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
147 /* the code in src/os/unix/ngx_sunpro_x86.il */
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
148
112
408f195b3482 nginx 0.3.3
Igor Sysoev <http://sysoev.ru>
parents: 110
diff changeset
149 #define ngx_memory_barrier() __asm (".volatile"); __asm (".nonvolatile")
408f195b3482 nginx 0.3.3
Igor Sysoev <http://sysoev.ru>
parents: 110
diff changeset
150
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
151
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
152 #else /* ( __GNUC__ || __INTEL_COMPILER ) */
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
153
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
154 #define NGX_HAVE_ATOMIC_OPS 1
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
155
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
156 #include "ngx_gcc_atomic_x86.h"
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
157
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
158 #endif
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
159
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
160
96
ca4f70b3ccc6 nginx 0.2.2
Igor Sysoev <http://sysoev.ru>
parents: 74
diff changeset
161 #elif ( __amd64__ || __amd64 )
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
162
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
163 typedef int64_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
164 typedef uint64_t ngx_atomic_uint_t;
44
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
165 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
166 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
167
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
168
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
169 #if ( __SUNPRO_C )
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
170
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
171 #define NGX_HAVE_ATOMIC_OPS 1
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
172
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
173 ngx_atomic_uint_t
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
174 ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old,
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
175 ngx_atomic_uint_t set);
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
176
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
177 ngx_atomic_int_t
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
178 ngx_atomic_fetch_add(ngx_atomic_t *value, ngx_atomic_int_t add);
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
179
320
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
180 /*
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
181 * Sun Studio 12 exits with segmentation fault on '__asm ("pause")',
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
182 * so ngx_cpu_pause is declared in src/os/unix/ngx_sunpro_amd64.il
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
183 */
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
184
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
185 void
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
186 ngx_cpu_pause(void);
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
187
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
188 /* the code in src/os/unix/ngx_sunpro_amd64.il */
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
189
112
408f195b3482 nginx 0.3.3
Igor Sysoev <http://sysoev.ru>
parents: 110
diff changeset
190 #define ngx_memory_barrier() __asm (".volatile"); __asm (".nonvolatile")
408f195b3482 nginx 0.3.3
Igor Sysoev <http://sysoev.ru>
parents: 110
diff changeset
191
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
192
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
193 #else /* ( __GNUC__ || __INTEL_COMPILER ) */
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
194
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
195 #define NGX_HAVE_ATOMIC_OPS 1
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
196
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
197 #include "ngx_gcc_atomic_amd64.h"
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
198
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
199 #endif
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
200
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
201
320
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
202 #elif ( __sparc__ || __sparc || __sparcv9 )
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
203
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
204 #if (NGX_PTR_SIZE == 8)
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
205
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
206 typedef int64_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
207 typedef uint64_t ngx_atomic_uint_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
208 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
209
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
210 #else
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
211
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
212 typedef int32_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
213 typedef uint32_t ngx_atomic_uint_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
214 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
215
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
216 #endif
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
217
44
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
218 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
219
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
220
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
221 #if ( __SUNPRO_C )
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
222
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
223 #define NGX_HAVE_ATOMIC_OPS 1
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
224
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
225 #include "ngx_sunpro_atomic_sparc64.h"
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
226
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
227
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
228 #else /* ( __GNUC__ || __INTEL_COMPILER ) */
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
229
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
230 #define NGX_HAVE_ATOMIC_OPS 1
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
231
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
232 #include "ngx_gcc_atomic_sparc64.h"
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
233
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
234 #endif
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
235
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
236
162
6be073125f2e nginx 0.3.28
Igor Sysoev <http://sysoev.ru>
parents: 160
diff changeset
237 #elif ( __powerpc__ || __POWERPC__ )
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
238
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
239 #define NGX_HAVE_ATOMIC_OPS 1
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
240
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
241 #if (NGX_PTR_SIZE == 8)
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
242
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
243 typedef int64_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
244 typedef uint64_t ngx_atomic_uint_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
245 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
246
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
247 #else
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
248
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
249 typedef int32_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
250 typedef uint32_t ngx_atomic_uint_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
251 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
252
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
253 #endif
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
254
44
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
255 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
256
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
257
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
258 #include "ngx_gcc_atomic_ppc.h"
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
259
270
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
260 #endif
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
261
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
262
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
263 #if !(NGX_HAVE_ATOMIC_OPS)
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
264
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
265 #define NGX_HAVE_ATOMIC_OPS 0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
266
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
267 typedef int32_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
268 typedef uint32_t ngx_atomic_uint_t;
44
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
269 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
270 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
271
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
272
44
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
273 static ngx_inline ngx_atomic_uint_t
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
274 ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old,
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
275 ngx_atomic_uint_t set)
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
276 {
120
e85dca77c46a nginx 0.3.7
Igor Sysoev <http://sysoev.ru>
parents: 112
diff changeset
277 if (*lock == old) {
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
278 *lock = set;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
279 return 1;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
280 }
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
281
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
282 return 0;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
283 }
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
284
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
285
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
286 static ngx_inline ngx_atomic_int_t
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
287 ngx_atomic_fetch_add(ngx_atomic_t *value, ngx_atomic_int_t add)
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
288 {
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
289 ngx_atomic_int_t old;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
290
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
291 old = *value;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
292 *value += add;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
293
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
294 return old;
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
295 }
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
296
120
e85dca77c46a nginx 0.3.7
Igor Sysoev <http://sysoev.ru>
parents: 112
diff changeset
297 #define ngx_memory_barrier()
160
73e8476f9142 nginx 0.3.27
Igor Sysoev <http://sysoev.ru>
parents: 120
diff changeset
298 #define ngx_cpu_pause()
120
e85dca77c46a nginx 0.3.7
Igor Sysoev <http://sysoev.ru>
parents: 112
diff changeset
299
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
300 #endif
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
301
270
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
302
160
73e8476f9142 nginx 0.3.27
Igor Sysoev <http://sysoev.ru>
parents: 120
diff changeset
303 void ngx_spinlock(ngx_atomic_t *lock, ngx_atomic_int_t value, ngx_uint_t spin);
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
304
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
305 #define ngx_trylock(lock) (*(lock) == 0 && ngx_atomic_cmp_set(lock, 0, 1))
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
306 #define ngx_unlock(lock) *(lock) = 0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
307
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
308
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
309 #endif /* _NGX_ATOMIC_H_INCLUDED_ */