comparison src/http/ngx_http_cache.c @ 200:abeaebe0a33c

nginx-0.0.1-2003-11-28-20:41:47 import
author Igor Sysoev <igor@sysoev.ru>
date Fri, 28 Nov 2003 17:41:47 +0000
parents a65b630b3a66
children 267ea1d98683
comparison
equal deleted inserted replaced
199:a65b630b3a66 200:abeaebe0a33c
171 } 171 }
172 172
173 ngx_mutex_unlock(&cache->mutex); 173 ngx_mutex_unlock(&cache->mutex);
174 174
175 return found; 175 return found;
176 }
177
178
179 void ngx_http_cache_unlock(ngx_http_cache_hash_t *hash,
180 ngx_http_cache_t *cache, ngx_log_t *log)
181 {
182 ngx_mutex_lock(&hash->mutex);
183
184 cache->refs--;
185
186 if (cache->refs == 0 && cache->deleted) {
187 ngx_log_debug(log, "CLOSE FILE: %d" _ cache->fd);
188 if (cache->fd != NGX_INVALID_FILE) {
189 if (ngx_close_file(cache->fd) == NGX_FILE_ERROR) {
190 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
191 ngx_close_file_n " \"%s\" failed",
192 cache->key.data);
193 }
194 }
195 cache->key.data = NULL;
196 }
197
198 ngx_mutex_unlock(&hash->mutex);
176 } 199 }
177 200
178 201
179 int ngx_http_cache_open_file(ngx_http_cache_ctx_t *ctx, ngx_file_uniq_t uniq) 202 int ngx_http_cache_open_file(ngx_http_cache_ctx_t *ctx, ngx_file_uniq_t uniq)
180 { 203 {