diff options
author | Igor Sysoev <igor@sysoev.ru> | 2003-11-28 20:41:47 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2003-11-28 20:41:47 +0300 |
commit | c2bba092eb07ea5fcd2e2ee987e3a304f755a3c7 (patch) | |
tree | d2c80489d1fe646f689966411fc8659355acbd40 /src/http/ngx_http_cache.c | |
parent | 877df63f345e48bc2cb61dde86a207748051b81a (diff) |
nginx-0.0.1-2003-11-28-20:41:47 import
Diffstat (limited to 'src/http/ngx_http_cache.c')
-rw-r--r-- | src/http/ngx_http_cache.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/http/ngx_http_cache.c b/src/http/ngx_http_cache.c index f5ef9206c..af38e7f31 100644 --- a/src/http/ngx_http_cache.c +++ b/src/http/ngx_http_cache.c @@ -176,6 +176,29 @@ ngx_http_cache_t *ngx_http_cache_alloc(ngx_http_cache_hash_t *cache, } +void ngx_http_cache_unlock(ngx_http_cache_hash_t *hash, + ngx_http_cache_t *cache, ngx_log_t *log) +{ + ngx_mutex_lock(&hash->mutex); + + cache->refs--; + + if (cache->refs == 0 && cache->deleted) { +ngx_log_debug(log, "CLOSE FILE: %d" _ cache->fd); + if (cache->fd != NGX_INVALID_FILE) { + if (ngx_close_file(cache->fd) == NGX_FILE_ERROR) { + ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, + ngx_close_file_n " \"%s\" failed", + cache->key.data); + } + } + cache->key.data = NULL; + } + + ngx_mutex_unlock(&hash->mutex); +} + + int ngx_http_cache_open_file(ngx_http_cache_ctx_t *ctx, ngx_file_uniq_t uniq) { ssize_t n; |