comparison src/event/ngx_event_accept.c @ 374:213f17e9f776

nginx-0.0.7-2004-07-02-09:47:00 import
author Igor Sysoev <igor@sysoev.ru>
date Fri, 02 Jul 2004 05:47:00 +0000
parents 018569a8f09c
children 41437e4fd9b4
comparison
equal deleted inserted replaced
373:018569a8f09c 374:213f17e9f776
208 208
209 instance = rev->instance; 209 instance = rev->instance;
210 rinstance = rev->returned_instance; 210 rinstance = rev->returned_instance;
211 winstance = wev->returned_instance; 211 winstance = wev->returned_instance;
212 212
213 #if (NGX_THREADS)
214
215 /*
216 * We has to acquire the lock to avoid the race condition when
217 * the connection was just closed by another thread but its lock
218 * is not unlocked at this point and we got the same descriptor.
219 *
220 * The condition should be too rare.
221 */
222
223 if (ngx_trylock(&c->lock) == 0) {
224
225 /* TODO: ngx_cycle->stat.accept.spinlock++; */
226
227 ngx_spinlock(&c->lock, 1000);
228 }
229
230 #endif
231
232 ngx_memzero(rev, sizeof(ngx_event_t)); 213 ngx_memzero(rev, sizeof(ngx_event_t));
233 ngx_memzero(wev, sizeof(ngx_event_t)); 214 ngx_memzero(wev, sizeof(ngx_event_t));
234 ngx_memzero(c, sizeof(ngx_connection_t)); 215 ngx_memzero(c, sizeof(ngx_connection_t));
235 216
236 /* ngx_memzero(c) does ngx_unlock(&c->lock); */ 217 /* ngx_memzero(c) does ngx_unlock(&c->lock); */