diff options
author | Igor Sysoev <igor@sysoev.ru> | 2004-03-03 19:14:15 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2004-03-03 19:14:15 +0300 |
commit | 5edf387f199efe5b67b2b81a00bc8404bea8365b (patch) | |
tree | 4db9a07a8c97513949fe2cb7709e57684d548eaa /src/http/ngx_http_cache.c | |
parent | ea17edc917ce07ceff023c304e29b2dad40718c4 (diff) |
nginx-0.0.2-2004-03-03-19:14:15 import
Diffstat (limited to 'src/http/ngx_http_cache.c')
-rw-r--r-- | src/http/ngx_http_cache.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/http/ngx_http_cache.c b/src/http/ngx_http_cache.c index 83d798258..479caeae9 100644 --- a/src/http/ngx_http_cache.c +++ b/src/http/ngx_http_cache.c @@ -40,7 +40,9 @@ ngx_http_cache_t *ngx_http_cache_get(ngx_http_cache_hash_t *hash, c = hash->elts + *crc % hash->hash * hash->nelts; - ngx_mutex_lock(&hash->mutex); + if (ngx_mutex_lock(&hash->mutex) == NGX_ERROR) { + return (void *) NGX_ERROR; + } for (i = 0; i < hash->nelts; i++) { if (c[i].crc == *crc @@ -95,7 +97,9 @@ ngx_http_cache_t *ngx_http_cache_alloc(ngx_http_cache_hash_t *hash, c = hash->elts + crc % hash->hash * hash->nelts; - ngx_mutex_lock(&hash->mutex); + if (ngx_mutex_lock(&hash->mutex) == NGX_ERROR) { + return (void *) NGX_ERROR; + } if (cache == NULL) { @@ -227,14 +231,18 @@ void ngx_http_cache_free(ngx_http_cache_t *cache, void ngx_http_cache_lock(ngx_http_cache_hash_t *hash, ngx_http_cache_t *cache) { - ngx_mutex_lock(&hash->mutex); + if (ngx_mutex_lock(&hash->mutex) == NGX_ERROR) { + return; + } } 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); + if (ngx_mutex_lock(&hash->mutex) == NGX_ERROR) { + return; + } cache->refs--; |