diff options
author | Igor Sysoev <igor@sysoev.ru> | 2004-02-25 23:16:15 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2004-02-25 23:16:15 +0300 |
commit | f2334416e7485ff1c260a46ba47aeadffeff923a (patch) | |
tree | d4d562a3c0c4af27ed23e9602cad653f1d4fec00 /src/core/ngx_times.c | |
parent | 14dab4563898155799a06007fff9c30c4dac8b26 (diff) |
nginx-0.0.2-2004-02-25-23:16:15 import
Diffstat (limited to 'src/core/ngx_times.c')
-rw-r--r-- | src/core/ngx_times.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/core/ngx_times.c b/src/core/ngx_times.c index 43c8c204a..235e7032d 100644 --- 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_THREADS) -#if (NGX_THREADS0) - if (!(ngx_time_mutex = ngx_mutex_init(log, NGX_MUTEX_LIGHT); - return 0; +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 } |