Mercurial > hg > nginx-vendor-current
annotate src/core/ngx_spinlock.c @ 340:10cc350ed8a1 NGINX_0_6_14
nginx 0.6.14
*) Change: now by default the "echo" SSI command uses entity encoding.
*) Feature: the "encoding" parameter in the "echo" SSI command.
*) Feature: the "access_log" directive may be used inside the
"limit_except" block.
*) Bugfix: if all upstream servers were failed, then all servers had
got weight the was equal one until servers became alive; bug
appeared in 0.6.6.
*) Bugfix: a segmentation fault occurred in worker process if
$date_local and $date_gmt were used outside the
ngx_http_ssi_filter_module.
*) Bugfix: a segmentation fault might occur in worker process if debug
log was enabled.
Thanks to Andrei Nigmatulin.
*) Bugfix: ngx_http_memcached_module did not set
$upstream_response_time.
Thanks to Maxim Dounin.
*) Bugfix: a worker process may got caught in an endless loop, if the
memcached was used.
*) Bugfix: nginx supported low case only "close" and "keep-alive"
values in the "Connection" request header line; bug appeared in
0.6.11.
*) Bugfix: sub_filter did not work with empty substitution.
*) Bugfix: in sub_filter parsing.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 15 Oct 2007 00:00:00 +0400 |
parents | 73e8476f9142 |
children | d0f7a625f27c |
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 } |