Mercurial > hg > nginx
comparison src/event/modules/ngx_kqueue_module.c @ 178:a8ff48d26cca
nginx-0.0.1-2003-11-11-00:09:22 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 10 Nov 2003 21:09:22 +0000 |
parents | c42be4185301 |
children | 9f3a78b06c48 |
comparison
equal
deleted
inserted
replaced
177:4db54fdbcbe7 | 178:a8ff48d26cca |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright (C) 2002-2003 Igor Sysoev, http://sysoev.ru | 3 * Copyright (C) 2002-2003 Igor Sysoev, http://sysoev.ru/en/ |
4 */ | 4 */ |
5 | 5 |
6 | 6 |
7 #include <ngx_config.h> | 7 #include <ngx_config.h> |
8 #include <ngx_core.h> | 8 #include <ngx_core.h> |
345 err = 0; | 345 err = 0; |
346 } | 346 } |
347 | 347 |
348 nchanges = 0; | 348 nchanges = 0; |
349 | 349 |
350 gettimeofday(&tv, NULL); | |
351 | |
352 if (ngx_cached_time != tv.tv_sec) { | |
353 ngx_cached_time = tv.tv_sec; | |
354 ngx_time_update(); | |
355 } | |
356 | |
350 if (timer) { | 357 if (timer) { |
351 gettimeofday(&tv, NULL); | |
352 delta = tv.tv_sec * 1000 + tv.tv_usec / 1000 - delta; | 358 delta = tv.tv_sec * 1000 + tv.tv_usec / 1000 - delta; |
353 | 359 |
354 #if (NGX_DEBUG_EVENT) | 360 #if (NGX_DEBUG_EVENT) |
355 ngx_log_debug(log, "kevent timer: %d, delta: %d" _ timer _ delta); | 361 ngx_log_debug(log, "kevent timer: %d, delta: %d" _ timer _ delta); |
356 #endif | 362 #endif |
357 | 363 |
358 /* The expired timers must be handled before a processing of the events | 364 /* |
359 because the new timers can be added during a processing */ | 365 * The expired timers must be handled before a processing of the events |
366 * because the new timers can be added during a processing | |
367 */ | |
360 | 368 |
361 ngx_event_expire_timers(delta); | 369 ngx_event_expire_timers(delta); |
362 | 370 |
363 } else { | 371 } else { |
364 if (events == 0) { | 372 if (events == 0) { |
411 case EVFILT_WRITE: | 419 case EVFILT_WRITE: |
412 | 420 |
413 instance = (uintptr_t) ev & 1; | 421 instance = (uintptr_t) ev & 1; |
414 ev = (void *) ((uintptr_t) ev & ~1); | 422 ev = (void *) ((uintptr_t) ev & ~1); |
415 | 423 |
416 /* It's a stale event from a file descriptor | 424 /* |
417 that was just closed in this iteration */ | 425 * it's a stale event from a file descriptor |
426 * that was just closed in this iteration | |
427 */ | |
418 | 428 |
419 if (ev->active == 0 || ev->instance != instance) { | 429 if (ev->active == 0 || ev->instance != instance) { |
420 ngx_log_debug(log, "stale kevent"); | 430 ngx_log_debug(log, "stale kevent"); |
421 continue; | 431 continue; |
422 } | 432 } |