Mercurial > hg > nginx-quic
diff src/http/ngx_http_cache.c @ 277:e91499541410
nginx-0.0.2-2004-03-03-19:14:15 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 03 Mar 2004 16:14:15 +0000 |
parents | c9da5900c79e |
children | da8c5707af39 |
line wrap: on
line diff
--- 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 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(n 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_ 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--;