summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ziv Scully <ziv@mit.edu>2015-11-20 11:51:14 -0500
committerGravatar Ziv Scully <ziv@mit.edu>2015-11-20 11:51:14 -0500
commit0271786bacdf9c12a142367a479b24ba111ebd17 (patch)
tree7766d19752df3661a6d178339dd02f753a7b91e7
parent081f815b457cdfe759b733a9adc18aab32127e45 (diff)
Add read locks around time read in store.
-rw-r--r--src/c/urweb.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c
index 12009f02..a6639ef2 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -4815,7 +4815,9 @@ void uw_Sqlcache_store(uw_context ctx, uw_Sqlcache_Cache *cache, char **keys, uw
update->value = value;
update->next = NULL;
// Can't use [uw_Sqlcache_getTimeNow] because it modifies state and we don't have the lock.
+ pthread_rwlock_rdlock(&cache->lockIn);
value->timeValid = cache->timeNow;
+ pthread_rwlock_unlock(&cache->lockIn);
if (ctx->cacheUpdateTail) {
ctx->cacheUpdateTail->next = update;
} else {