Mercurial > hg > nginx-vendor-0-8
annotate src/core/ngx_spinlock.c @ 290:f745bf973510 NGINX_0_5_15
nginx 0.5.15
*) Feature: the mail proxy supports authenticated SMTP proxying and the
"smtp_auth", "smtp_capablities", and "xclient" directives.
Thanks to Anton Yuzhaninov and Maxim Dounin.
*) Feature: now the keep-alive connections are closed just after
receiving the reconfiguration signal.
*) Change: the "imap" and "auth" directives were renamed to the "mail"
and "pop3_auth" directives.
*) Bugfix: a segmentation fault occurred in worker process if the
CRAM-MD5 authentication method was used and the APOP method was
disabled.
*) Bugfix: if the "starttls only" directive was used in POP3 protocol,
then nginx allowed authentication without switching to the SSL mode.
*) Bugfix: worker processes did not exit after reconfiguration and did
not rotate logs if the eventport method was used.
*) Bugfix: a worker process may got caught in an endless loop, if the
"ip_hash" directive was used.
*) Bugfix: now nginx does not log some alerts if eventport or /dev/poll
methods are used.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 19 Mar 2007 00:00:00 +0300 |
parents | 73e8476f9142 |
children |
rev | line source |
---|---|
0 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 */ | |
5 | |
6 | |
7 #include <ngx_config.h> | |
8 #include <ngx_core.h> | |
9 | |
10 | |
112 | 11 void |
160 | 12 ngx_spinlock(ngx_atomic_t *lock, ngx_atomic_int_t value, ngx_uint_t spin) |
0 | 13 { |
14 | |
15 #if (NGX_HAVE_ATOMIC_OPS) | |
16 | |
160 | 17 ngx_uint_t i, n; |
0 | 18 |
19 for ( ;; ) { | |
20 | |
160 | 21 if (*lock == 0 && ngx_atomic_cmp_set(lock, 0, value)) { |
22 return; | |
23 } | |
24 | |
25 if (ngx_ncpu > 1) { | |
26 | |
27 for (n = 1; n < spin; n <<= 1) { | |
0 | 28 |
160 | 29 for (i = 0; i < n; i++) { |
30 ngx_cpu_pause(); | |
31 } | |
0 | 32 |
160 | 33 if (*lock == 0 && ngx_atomic_cmp_set(lock, 0, value)) { |
34 return; | |
35 } | |
0 | 36 } |
37 } | |
160 | 38 |
39 ngx_sched_yield(); | |
0 | 40 } |
41 | |
42 #else | |
43 | |
44 #if (NGX_THREADS) | |
45 | |
46 #error ngx_spinlock() or ngx_atomic_cmp_set() are not defined ! | |
47 | |
48 #endif | |
49 | |
50 #endif | |
51 | |
52 } |