Mercurial > hg > nginx-vendor-current
annotate src/core/ngx_spinlock.c @ 142:84910468f6de NGINX_0_3_18
nginx 0.3.18
*) Feature: the "server_names" directive supports the ".domain.tld"
names.
*) Feature: the "server_names" directive uses the hash for the
"*.domain.tld" names and more effective hash for usual names.
*) Change: the "server_names_hash_max_size" and
"server_names_hash_bucket_size" directives.
*) Change: the "server_names_hash" and "server_names_hash_threshold"
directives were canceled.
*) Feature: the "valid_referers" directive uses the hash site names.
*) Change: now the "valid_referers" directive checks the site names
only without the URI part.
*) Bugfix: some ".domain.tld" names incorrectly processed by the
ngx_http_map_module.
*) Bugfix: segmentation fault was occurred if configuration file did
not exist; bug appeared in 0.3.12.
*) Bugfix: on 64-bit platforms segmentation fault may occurred on
start; bug appeared in 0.3.16.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 26 Dec 2005 00:00:00 +0300 |
parents | 408f195b3482 |
children | 73e8476f9142 |
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 | |
42 | 11 /* |
12 * TODO: the P4 optimized assembler version with the "pause" operation | |
13 */ | |
14 | |
112 | 15 void |
16 ngx_spinlock(ngx_atomic_t *lock, ngx_uint_t spin) | |
0 | 17 { |
18 | |
19 #if (NGX_HAVE_ATOMIC_OPS) | |
20 | |
21 ngx_uint_t tries; | |
22 | |
23 tries = 0; | |
24 | |
25 for ( ;; ) { | |
26 | |
27 if (*lock) { | |
28 if (ngx_ncpu > 1 && tries++ < spin) { | |
29 continue; | |
30 } | |
31 | |
32 ngx_sched_yield(); | |
33 | |
34 tries = 0; | |
35 | |
36 } else { | |
37 if (ngx_atomic_cmp_set(lock, 0, 1)) { | |
38 return; | |
39 } | |
40 } | |
41 } | |
42 | |
43 #else | |
44 | |
45 #if (NGX_THREADS) | |
46 | |
47 #error ngx_spinlock() or ngx_atomic_cmp_set() are not defined ! | |
48 | |
49 #endif | |
50 | |
51 #endif | |
52 | |
53 } |