comparison src/c/urweb.c @ 2303:42079884e34a

Add read locks around time read in store.
author Ziv Scully <ziv@mit.edu>
date Fri, 20 Nov 2015 11:51:14 -0500
parents ace43b90b388
children 6fb9232ade99
comparison
equal deleted inserted replaced
2302:ace43b90b388 2303:42079884e34a
4813 update->cache = cache; 4813 update->cache = cache;
4814 update->keys = uw_Sqlcache_copyKeys(keys, cache->numKeys); 4814 update->keys = uw_Sqlcache_copyKeys(keys, cache->numKeys);
4815 update->value = value; 4815 update->value = value;
4816 update->next = NULL; 4816 update->next = NULL;
4817 // Can't use [uw_Sqlcache_getTimeNow] because it modifies state and we don't have the lock. 4817 // Can't use [uw_Sqlcache_getTimeNow] because it modifies state and we don't have the lock.
4818 pthread_rwlock_rdlock(&cache->lockIn);
4818 value->timeValid = cache->timeNow; 4819 value->timeValid = cache->timeNow;
4820 pthread_rwlock_unlock(&cache->lockIn);
4819 if (ctx->cacheUpdateTail) { 4821 if (ctx->cacheUpdateTail) {
4820 ctx->cacheUpdateTail->next = update; 4822 ctx->cacheUpdateTail->next = update;
4821 } else { 4823 } else {
4822 ctx->cacheUpdate = update; 4824 ctx->cacheUpdate = update;
4823 } 4825 }