annotate src/os/unix/ngx_atomic.h @ 556:25255878df91 NGINX_0_8_30

nginx 0.8.30 *) Change: now the default buffer size of the "large_client_header_buffers" directive is 8K. Thanks to Andrew Cholakian. *) Feature: the conf/fastcgi.conf for simple FastCGI configurations. *) Bugfix: nginx/Windows tried to rename a temporary file twice if the file should replace an already existent file. *) Bugfix: of "double free or corruption" error issued if host could not be resolved; the bug had appeared in 0.8.22. Thanks to Konstantin Svist. *) Bugfix: in libatomic usage on some platforms. Thanks to W-Mark Kubacki.
author Igor Sysoev <http://sysoev.ru>
date Tue, 15 Dec 2009 00:00:00 +0300
parents 5c576ea5dbd9
children d0f7a625f27c
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
556
25255878df91 nginx 0.8.30
Igor Sysoev <http://sysoev.ru>
parents: 554
diff changeset
17 #define AO_REQUIRE_CAS
554
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
18 #include <atomic_ops.h>
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
19
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
20 #define NGX_HAVE_ATOMIC_OPS 1
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
21
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
22 typedef long ngx_atomic_int_t;
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
23 typedef AO_t ngx_atomic_uint_t;
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
24 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
25
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
26 #if (NGX_PTR_SIZE == 8)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
27 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
28 #else
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
29 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
30 #endif
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
31
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
32 #define ngx_atomic_cmp_set(lock, old, new) \
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
33 AO_compare_and_swap(lock, old, new)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
34 #define ngx_atomic_fetch_add(value, add) \
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
35 AO_fetch_and_add(value, add)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
36 #define ngx_memory_barrier() AO_nop()
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
37 #define ngx_cpu_pause()
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
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
40 #elif (NGX_DARWIN_ATOMIC)
270
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 /*
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
43 * use Darwin 8 atomic(3) and barrier(3) operations
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
44 * optimized at run-time for UP and SMP
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
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
47 #include <libkern/OSAtomic.h>
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
48
392
34fb3a573548 nginx 0.7.8
Igor Sysoev <http://sysoev.ru>
parents: 320
diff changeset
49 /* "bool" conflicts with perl's CORE/handy.h */
270
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
50 #undef bool
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
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
53 #define NGX_HAVE_ATOMIC_OPS 1
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
54
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
55 #if (NGX_PTR_SIZE == 8)
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
56
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
57 typedef int64_t ngx_atomic_int_t;
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
58 typedef uint64_t ngx_atomic_uint_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
59 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
270
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
60
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
61 #define ngx_atomic_cmp_set(lock, old, new) \
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
62 OSAtomicCompareAndSwap64Barrier(old, new, (int64_t *) lock)
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
63
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
64 #define ngx_atomic_fetch_add(value, add) \
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
65 (OSAtomicAdd64(add, (int64_t *) value) - add)
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
66
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
67 #else
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
68
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
69 typedef int32_t ngx_atomic_int_t;
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
70 typedef uint32_t ngx_atomic_uint_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
71 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
270
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
72
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
73 #define ngx_atomic_cmp_set(lock, old, new) \
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
74 OSAtomicCompareAndSwap32Barrier(old, new, (int32_t *) lock)
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
75
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
76 #define ngx_atomic_fetch_add(value, add) \
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
77 (OSAtomicAdd32(add, (int32_t *) value) - add)
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
78
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
79 #endif
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
80
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
81 #define ngx_memory_barrier() OSMemoryBarrier()
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
82
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
83 #define ngx_cpu_pause()
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
84
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
85 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
86
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
87
554
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
88 #elif (NGX_HAVE_GCC_ATOMIC)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
89
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
90 /* GCC 4.1 builtin atomic operations */
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
91
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
92 #define NGX_HAVE_ATOMIC_OPS 1
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
93
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
94 typedef long ngx_atomic_int_t;
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
95 typedef unsigned long ngx_atomic_uint_t;
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
96
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
97 #if (NGX_PTR_SIZE == 8)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
98 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
99 #else
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
100 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
101 #endif
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
102
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
103 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
270
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
104
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
105
554
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
106 #define ngx_atomic_cmp_set(lock, old, set) \
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
107 __sync_bool_compare_and_swap(lock, old, set)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
108
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
109 #define ngx_atomic_fetch_add(value, add) \
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
110 __sync_fetch_and_add(value, add)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
111
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
112 #define ngx_memory_barrier() __sync_synchronize()
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
113
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
114 #if ( __i386__ || __i386 || __amd64__ || __amd64 )
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
115 #define ngx_cpu_pause() __asm__ ("pause")
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
116 #else
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
117 #define ngx_cpu_pause()
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
118 #endif
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
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
121 #elif ( __i386__ || __i386 )
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
122
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
123 typedef int32_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
124 typedef uint32_t ngx_atomic_uint_t;
44
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
125 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
126 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
127
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
128
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
129 #if ( __SUNPRO_C )
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
130
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
131 #define NGX_HAVE_ATOMIC_OPS 1
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
132
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
133 ngx_atomic_uint_t
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
134 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
135 ngx_atomic_uint_t set);
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
136
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
137 ngx_atomic_int_t
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
138 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
139
320
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
140 /*
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
141 * Sun Studio 12 exits with segmentation fault on '__asm ("pause")',
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
142 * 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
143 */
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
144
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
145 void
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
146 ngx_cpu_pause(void);
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
147
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
148 /* 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
149
112
408f195b3482 nginx 0.3.3
Igor Sysoev <http://sysoev.ru>
parents: 110
diff changeset
150 #define ngx_memory_barrier() __asm (".volatile"); __asm (".nonvolatile")
408f195b3482 nginx 0.3.3
Igor Sysoev <http://sysoev.ru>
parents: 110
diff changeset
151
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
152
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
153 #else /* ( __GNUC__ || __INTEL_COMPILER ) */
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
154
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
155 #define NGX_HAVE_ATOMIC_OPS 1
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
156
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
157 #include "ngx_gcc_atomic_x86.h"
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
158
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
159 #endif
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
160
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
161
96
ca4f70b3ccc6 nginx 0.2.2
Igor Sysoev <http://sysoev.ru>
parents: 74
diff changeset
162 #elif ( __amd64__ || __amd64 )
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
163
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
164 typedef int64_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
165 typedef uint64_t ngx_atomic_uint_t;
44
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
166 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
167 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
168
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
169
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
170 #if ( __SUNPRO_C )
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
171
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
172 #define NGX_HAVE_ATOMIC_OPS 1
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
173
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
174 ngx_atomic_uint_t
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
175 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
176 ngx_atomic_uint_t set);
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
177
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
178 ngx_atomic_int_t
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
179 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
180
320
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
181 /*
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
182 * Sun Studio 12 exits with segmentation fault on '__asm ("pause")',
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
183 * 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
184 */
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
185
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
186 void
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
187 ngx_cpu_pause(void);
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
188
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
189 /* the code in src/os/unix/ngx_sunpro_amd64.il */
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
190
112
408f195b3482 nginx 0.3.3
Igor Sysoev <http://sysoev.ru>
parents: 110
diff changeset
191 #define ngx_memory_barrier() __asm (".volatile"); __asm (".nonvolatile")
408f195b3482 nginx 0.3.3
Igor Sysoev <http://sysoev.ru>
parents: 110
diff changeset
192
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
193
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
194 #else /* ( __GNUC__ || __INTEL_COMPILER ) */
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
195
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
196 #define NGX_HAVE_ATOMIC_OPS 1
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
197
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
198 #include "ngx_gcc_atomic_amd64.h"
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
199
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
200 #endif
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
201
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
202
320
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
203 #elif ( __sparc__ || __sparc || __sparcv9 )
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
204
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
205 #if (NGX_PTR_SIZE == 8)
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
206
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
207 typedef int64_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
208 typedef uint64_t ngx_atomic_uint_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
209 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
210
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
211 #else
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
212
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
213 typedef int32_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
214 typedef uint32_t ngx_atomic_uint_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
215 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
216
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
217 #endif
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
218
44
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
219 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
220
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
221
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
222 #if ( __SUNPRO_C )
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
223
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
224 #define NGX_HAVE_ATOMIC_OPS 1
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
225
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
226 #include "ngx_sunpro_atomic_sparc64.h"
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
227
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
228
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
229 #else /* ( __GNUC__ || __INTEL_COMPILER ) */
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
230
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
231 #define NGX_HAVE_ATOMIC_OPS 1
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
232
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
233 #include "ngx_gcc_atomic_sparc64.h"
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
234
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
235 #endif
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
236
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
237
162
6be073125f2e nginx 0.3.28
Igor Sysoev <http://sysoev.ru>
parents: 160
diff changeset
238 #elif ( __powerpc__ || __POWERPC__ )
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
239
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
240 #define NGX_HAVE_ATOMIC_OPS 1
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
241
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
242 #if (NGX_PTR_SIZE == 8)
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
243
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
244 typedef int64_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
245 typedef uint64_t ngx_atomic_uint_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
246 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
247
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
248 #else
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
249
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
250 typedef int32_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
251 typedef uint32_t ngx_atomic_uint_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
252 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
253
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
254 #endif
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
255
44
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
256 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
257
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
258
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
259 #include "ngx_gcc_atomic_ppc.h"
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
260
270
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
261 #endif
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
262
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
263
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
264 #if !(NGX_HAVE_ATOMIC_OPS)
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
265
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
266 #define NGX_HAVE_ATOMIC_OPS 0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
267
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
268 typedef int32_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
269 typedef uint32_t ngx_atomic_uint_t;
44
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
270 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
271 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
272
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
273
44
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
274 static ngx_inline ngx_atomic_uint_t
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
275 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
276 ngx_atomic_uint_t set)
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
277 {
120
e85dca77c46a nginx 0.3.7
Igor Sysoev <http://sysoev.ru>
parents: 112
diff changeset
278 if (*lock == old) {
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
279 *lock = set;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
280 return 1;
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
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
283 return 0;
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
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
287 static ngx_inline ngx_atomic_int_t
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
288 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
289 {
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
290 ngx_atomic_int_t old;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
291
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
292 old = *value;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
293 *value += add;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
294
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
295 return old;
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
296 }
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
297
120
e85dca77c46a nginx 0.3.7
Igor Sysoev <http://sysoev.ru>
parents: 112
diff changeset
298 #define ngx_memory_barrier()
160
73e8476f9142 nginx 0.3.27
Igor Sysoev <http://sysoev.ru>
parents: 120
diff changeset
299 #define ngx_cpu_pause()
120
e85dca77c46a nginx 0.3.7
Igor Sysoev <http://sysoev.ru>
parents: 112
diff changeset
300
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
301 #endif
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
302
270
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
303
160
73e8476f9142 nginx 0.3.27
Igor Sysoev <http://sysoev.ru>
parents: 120
diff changeset
304 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
305
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
306 #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
307 #define ngx_unlock(lock) *(lock) = 0
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
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
310 #endif /* _NGX_ATOMIC_H_INCLUDED_ */