Mercurial > hg > nginx
diff src/core/ngx_times.c @ 270:7bb9562216ce
nginx-0.0.2-2004-02-25-23:16:15 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 25 Feb 2004 20:16:15 +0000 |
parents | 5238e93961a1 |
children | e16dfb9b9afa |
line wrap: on
line diff
--- a/src/core/ngx_times.c +++ b/src/core/ngx_times.c @@ -51,15 +51,22 @@ void ngx_time_init() ngx_elapsed_msec = 0; ngx_time_update(tv.tv_sec); +} -#if (NGX_THREADS0) - if (!(ngx_time_mutex = ngx_mutex_init(log, NGX_MUTEX_LIGHT); - return 0; + +#if (NGX_THREADS) + +ngx_int_t ngx_time_mutex_init(ngx_log_t *log) +{ + if (!(ngx_time_mutex = ngx_mutex_init(log, NGX_MUTEX_LIGHT))) { + return NGX_ERROR; } -#endif + return NGX_OK; } +#endif + void ngx_time_update(time_t s) { @@ -69,9 +76,11 @@ void ngx_time_update(time_t s) return; } -#if (NGX_THREADS0) - if (ngx_mutex_trylock(ngx_time_mutex) != NGX_OK) { - return; +#if (NGX_THREADS) + if (ngx_time_mutex) { + if (ngx_mutex_trylock(ngx_time_mutex) != NGX_OK) { + return; + } } #endif @@ -109,8 +118,10 @@ void ngx_time_update(time_t s) tm.ngx_tm_min, tm.ngx_tm_sec); -#if (NGX_THREADS0) - ngx_mutex_unlock(ngx_time_mutex); +#if (NGX_THREADS) + if (ngx_time_mutex) { + ngx_mutex_unlock(ngx_time_mutex); + } #endif }