Ignore:
Timestamp:
2013-09-09T18:27:40+02:00 (14 months ago)
Author:
moo
Message:

cacher: merge [1366] from trunk; fixes #323: refix locking impl for threaded env

Location:
branches/3.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0

    • Property svn:mergeinfo changed
      /trunkmerged: 1366
  • branches/3.0/mod_cacher/xc_cacher.c

    r1239 r1367  
    3737#define VAR_ENTRY_EXPIRED(pentry) ((pentry)->ttl && XG(request_time) > (pentry)->ctime + (time_t) (pentry)->ttl) 
    3838#define CHECK(x, e) do { if ((x) == NULL) { zend_error(E_ERROR, "XCache: " e); goto err; } } while (0) 
    39 #define LOCK(x) xc_lock((x)->lck) 
    40 #define UNLOCK(x) xc_unlock((x)->lck) 
     39#define LOCK(x) xc_mutex_lock((x)->mutex) 
     40#define UNLOCK(x) xc_mutex_unlock((x)->mutex) 
    4141 
    4242#define ENTER_LOCK_EX(x) \ 
     
    101101    xc_hash_t  *hcache; /* hash to cacheid */ 
    102102 
    103     struct _xc_lock_t  *lck; 
     103    struct _xc_mutex_t *mutex; 
    104104    struct _xc_shm_t   *shm; /* which shm contains us */ 
    105105    xc_allocator_t *allocator; 
     
    26112611        xc_cache_t *cache = &caches[i]; 
    26122612        if (cache) { 
    2613             if (cache->lck) { 
    2614                 xc_lock_destroy(cache->lck); 
    2615             } 
    2616             /* do NOT touch cached data */ 
     2613            /* do NOT touch cached data, do not release mutex shared inside cache */ 
     2614            if (cache->mutex) { 
     2615                xc_mutex_destroy(cache->mutex); 
     2616            } 
    26172617            shm = cache->shm; 
    26182618            if (shm) { 
     
    26612661            CHECK(cache->cached->phps = allocator->vtable->calloc(allocator, hphp->size, sizeof(xc_entry_data_php_t*)), "create phps OOM"); 
    26622662        } 
    2663         CHECK(cache->lck              = allocator->vtable->calloc(allocator, 1, xc_lock_size()), "create lock OOM"); 
    2664         CHECK(xc_lock_init(cache->lck, NULL, 1), "can't create lock"); 
     2663        CHECK(cache->mutex            = allocator->vtable->calloc(allocator, 1, xc_mutex_size()), "create lock OOM"); 
     2664        CHECK(cache->mutex = xc_mutex_init(cache->mutex, NULL, 1), "can't create mutex"); 
    26652665 
    26662666        cache->hcache  = hcache; 
Note: See TracChangeset for help on using the changeset viewer.