changeset 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
files src/c/urweb.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/c/urweb.c	Fri Nov 20 10:51:43 2015 -0500
+++ b/src/c/urweb.c	Fri Nov 20 11:51:14 2015 -0500
@@ -4815,7 +4815,9 @@
   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 {