annotate src/os/unix/ngx_atomic.h @ 682:5cb5db9975ba NGINX_1_3_4

nginx 1.3.4 *) Change: the "ipv6only" parameter is now turned on by default for listening IPv6 sockets. *) Feature: the Clang compiler support. *) Bugfix: extra listening sockets might be created. Thanks to Roman Odaisky. *) Bugfix: nginx/Windows might hog CPU if a worker process failed to start. Thanks to Ricardo Villalobos Guevara. *) Bugfix: the "proxy_pass_header", "fastcgi_pass_header", "scgi_pass_header", "uwsgi_pass_header", "proxy_hide_header", "fastcgi_hide_header", "scgi_hide_header", and "uwsgi_hide_header" directives might be inherited incorrectly.
author Igor Sysoev <http://sysoev.ru>
date Tue, 31 Jul 2012 00:00:00 +0400
parents d0f7a625f27c
children
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
660
d0f7a625f27c nginx 1.1.14
Igor Sysoev <http://sysoev.ru>
parents: 556
diff changeset
4 * Copyright (C) Nginx, Inc.
0
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
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
8 #ifndef _NGX_ATOMIC_H_INCLUDED_
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
9 #define _NGX_ATOMIC_H_INCLUDED_
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
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
12 #include <ngx_config.h>
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
13 #include <ngx_core.h>
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
14
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
15
554
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
16 #if (NGX_HAVE_LIBATOMIC)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
17
556
25255878df91 nginx 0.8.30
Igor Sysoev <http://sysoev.ru>
parents: 554
diff changeset
18 #define AO_REQUIRE_CAS
554
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
19 #include <atomic_ops.h>
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 #define NGX_HAVE_ATOMIC_OPS 1
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
22
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
23 typedef long ngx_atomic_int_t;
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
24 typedef AO_t ngx_atomic_uint_t;
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
25 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
26
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
27 #if (NGX_PTR_SIZE == 8)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
28 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
29 #else
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
30 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
31 #endif
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
32
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
33 #define ngx_atomic_cmp_set(lock, old, new) \
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
34 AO_compare_and_swap(lock, old, new)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
35 #define ngx_atomic_fetch_add(value, add) \
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
36 AO_fetch_and_add(value, add)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
37 #define ngx_memory_barrier() AO_nop()
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
38 #define ngx_cpu_pause()
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
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
41 #elif (NGX_DARWIN_ATOMIC)
270
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 /*
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
44 * use Darwin 8 atomic(3) and barrier(3) operations
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
45 * optimized at run-time for UP and SMP
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
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
48 #include <libkern/OSAtomic.h>
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
49
392
34fb3a573548 nginx 0.7.8
Igor Sysoev <http://sysoev.ru>
parents: 320
diff changeset
50 /* "bool" conflicts with perl's CORE/handy.h */
682
5cb5db9975ba nginx 1.3.4
Igor Sysoev <http://sysoev.ru>
parents: 660
diff changeset
51 #if 0
270
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
52 #undef bool
682
5cb5db9975ba nginx 1.3.4
Igor Sysoev <http://sysoev.ru>
parents: 660
diff changeset
53 #endif
270
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
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
56 #define NGX_HAVE_ATOMIC_OPS 1
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
57
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
58 #if (NGX_PTR_SIZE == 8)
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 typedef int64_t ngx_atomic_int_t;
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
61 typedef uint64_t ngx_atomic_uint_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
62 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
270
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_cmp_set(lock, old, new) \
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
65 OSAtomicCompareAndSwap64Barrier(old, new, (int64_t *) lock)
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 #define ngx_atomic_fetch_add(value, add) \
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
68 (OSAtomicAdd64(add, (int64_t *) value) - add)
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
69
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
70 #else
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 typedef int32_t ngx_atomic_int_t;
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
73 typedef uint32_t ngx_atomic_uint_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
74 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
270
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_cmp_set(lock, old, new) \
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
77 OSAtomicCompareAndSwap32Barrier(old, new, (int32_t *) lock)
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 #define ngx_atomic_fetch_add(value, add) \
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
80 (OSAtomicAdd32(add, (int32_t *) value) - add)
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 #endif
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 #define ngx_memory_barrier() OSMemoryBarrier()
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 #define ngx_cpu_pause()
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
87
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
88 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
89
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
90
554
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
91 #elif (NGX_HAVE_GCC_ATOMIC)
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 /* GCC 4.1 builtin atomic operations */
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
94
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
95 #define NGX_HAVE_ATOMIC_OPS 1
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 typedef long ngx_atomic_int_t;
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
98 typedef unsigned long ngx_atomic_uint_t;
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
99
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
100 #if (NGX_PTR_SIZE == 8)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
101 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
102 #else
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
103 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
104 #endif
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
105
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
106 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
270
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
107
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
108
554
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
109 #define ngx_atomic_cmp_set(lock, old, set) \
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
110 __sync_bool_compare_and_swap(lock, old, set)
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_atomic_fetch_add(value, add) \
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
113 __sync_fetch_and_add(value, add)
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
114
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
115 #define ngx_memory_barrier() __sync_synchronize()
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
116
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
117 #if ( __i386__ || __i386 || __amd64__ || __amd64 )
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
118 #define ngx_cpu_pause() __asm__ ("pause")
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
119 #else
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
120 #define ngx_cpu_pause()
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
121 #endif
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
122
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
123
5c576ea5dbd9 nginx 0.8.29
Igor Sysoev <http://sysoev.ru>
parents: 530
diff changeset
124 #elif ( __i386__ || __i386 )
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
125
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
126 typedef int32_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
127 typedef uint32_t ngx_atomic_uint_t;
44
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
128 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
129 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
130
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 #if ( __SUNPRO_C )
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
133
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
134 #define NGX_HAVE_ATOMIC_OPS 1
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_uint_t
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
137 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
138 ngx_atomic_uint_t set);
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
139
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
140 ngx_atomic_int_t
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
141 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
142
320
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 * Sun Studio 12 exits with segmentation fault on '__asm ("pause")',
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
145 * 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
146 */
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
147
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
148 void
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
149 ngx_cpu_pause(void);
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
150
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
151 /* 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
152
112
408f195b3482 nginx 0.3.3
Igor Sysoev <http://sysoev.ru>
parents: 110
diff changeset
153 #define ngx_memory_barrier() __asm (".volatile"); __asm (".nonvolatile")
408f195b3482 nginx 0.3.3
Igor Sysoev <http://sysoev.ru>
parents: 110
diff changeset
154
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 #else /* ( __GNUC__ || __INTEL_COMPILER ) */
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
157
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
158 #define NGX_HAVE_ATOMIC_OPS 1
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
159
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
160 #include "ngx_gcc_atomic_x86.h"
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
161
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
162 #endif
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
163
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
164
96
ca4f70b3ccc6 nginx 0.2.2
Igor Sysoev <http://sysoev.ru>
parents: 74
diff changeset
165 #elif ( __amd64__ || __amd64 )
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
166
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
167 typedef int64_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
168 typedef uint64_t ngx_atomic_uint_t;
44
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
169 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
170 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
171
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 #if ( __SUNPRO_C )
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
174
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
175 #define NGX_HAVE_ATOMIC_OPS 1
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_uint_t
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
178 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
179 ngx_atomic_uint_t set);
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
180
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
181 ngx_atomic_int_t
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
182 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
183
320
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 * Sun Studio 12 exits with segmentation fault on '__asm ("pause")',
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
186 * 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
187 */
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
188
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
189 void
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
190 ngx_cpu_pause(void);
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
191
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
192 /* the code in src/os/unix/ngx_sunpro_amd64.il */
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
193
112
408f195b3482 nginx 0.3.3
Igor Sysoev <http://sysoev.ru>
parents: 110
diff changeset
194 #define ngx_memory_barrier() __asm (".volatile"); __asm (".nonvolatile")
408f195b3482 nginx 0.3.3
Igor Sysoev <http://sysoev.ru>
parents: 110
diff changeset
195
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 #else /* ( __GNUC__ || __INTEL_COMPILER ) */
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 #define NGX_HAVE_ATOMIC_OPS 1
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
200
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
201 #include "ngx_gcc_atomic_amd64.h"
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
202
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
203 #endif
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
204
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
205
320
95183808f549 nginx 0.6.4
Igor Sysoev <http://sysoev.ru>
parents: 270
diff changeset
206 #elif ( __sparc__ || __sparc || __sparcv9 )
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
207
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
208 #if (NGX_PTR_SIZE == 8)
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
209
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
210 typedef int64_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
211 typedef uint64_t ngx_atomic_uint_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
212 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
213
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
214 #else
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
215
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
216 typedef int32_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
217 typedef uint32_t ngx_atomic_uint_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
218 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
219
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
220 #endif
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
221
44
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
222 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
223
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 #if ( __SUNPRO_C )
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
226
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
227 #define NGX_HAVE_ATOMIC_OPS 1
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 #include "ngx_sunpro_atomic_sparc64.h"
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
230
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 #else /* ( __GNUC__ || __INTEL_COMPILER ) */
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
233
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
234 #define NGX_HAVE_ATOMIC_OPS 1
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
235
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
236 #include "ngx_gcc_atomic_sparc64.h"
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
237
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
238 #endif
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
162
6be073125f2e nginx 0.3.28
Igor Sysoev <http://sysoev.ru>
parents: 160
diff changeset
241 #elif ( __powerpc__ || __POWERPC__ )
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
242
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
243 #define NGX_HAVE_ATOMIC_OPS 1
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
244
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
245 #if (NGX_PTR_SIZE == 8)
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
246
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
247 typedef int64_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
248 typedef uint64_t ngx_atomic_uint_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
249 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
250
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
251 #else
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
252
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
253 typedef int32_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
254 typedef uint32_t ngx_atomic_uint_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
255 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
256
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
257 #endif
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
258
44
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
259 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
260
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
261
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
262 #include "ngx_gcc_atomic_ppc.h"
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
263
270
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
264 #endif
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
265
42
41ccba1aba45 nginx 0.1.21
Igor Sysoev <http://sysoev.ru>
parents: 0
diff changeset
266
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
267 #if !(NGX_HAVE_ATOMIC_OPS)
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
268
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
269 #define NGX_HAVE_ATOMIC_OPS 0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
270
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
271 typedef int32_t ngx_atomic_int_t;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
272 typedef uint32_t ngx_atomic_uint_t;
44
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
273 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
530
4c5d2c627a6c nginx 0.8.17
Igor Sysoev <http://sysoev.ru>
parents: 392
diff changeset
274 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
275
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
276
44
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
277 static ngx_inline ngx_atomic_uint_t
4989c3d25945 nginx 0.1.22
Igor Sysoev <http://sysoev.ru>
parents: 42
diff changeset
278 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
279 ngx_atomic_uint_t set)
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
280 {
120
e85dca77c46a nginx 0.3.7
Igor Sysoev <http://sysoev.ru>
parents: 112
diff changeset
281 if (*lock == old) {
110
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
282 *lock = set;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
283 return 1;
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 return 0;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
287 }
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
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
290 static ngx_inline ngx_atomic_int_t
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
291 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
292 {
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
293 ngx_atomic_int_t old;
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 old = *value;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
296 *value += add;
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
297
dad2fe8ecf08 nginx 0.3.2
Igor Sysoev <http://sysoev.ru>
parents: 100
diff changeset
298 return old;
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
299 }
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
300
120
e85dca77c46a nginx 0.3.7
Igor Sysoev <http://sysoev.ru>
parents: 112
diff changeset
301 #define ngx_memory_barrier()
160
73e8476f9142 nginx 0.3.27
Igor Sysoev <http://sysoev.ru>
parents: 120
diff changeset
302 #define ngx_cpu_pause()
120
e85dca77c46a nginx 0.3.7
Igor Sysoev <http://sysoev.ru>
parents: 112
diff changeset
303
0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
304 #endif
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
305
270
6eb1e38f0f1f nginx 0.5.5
Igor Sysoev <http://sysoev.ru>
parents: 162
diff changeset
306
160
73e8476f9142 nginx 0.3.27
Igor Sysoev <http://sysoev.ru>
parents: 120
diff changeset
307 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
308
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
309 #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
310 #define ngx_unlock(lock) *(lock) = 0
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
311
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
312
f0b350454894 nginx 0.1.0
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
313 #endif /* _NGX_ATOMIC_H_INCLUDED_ */