summaryrefslogtreecommitdiff
path: root/assoc.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2012-09-02 23:45:47 -0700
committerdormando <dormando@rydia.net>2012-09-03 11:22:59 -0700
commit8963836cf38205fc1fe315e7783f8325df5031cd (patch)
tree586632d9b714a7c787f627f251474721b7bf9b67 /assoc.c
parent0adbf816d0c3813361fa8061ecc8a3e1a2dd6273 (diff)
downloadmemcached-8963836cf38205fc1fe315e7783f8325df5031cd.tar.gz
don't wait on condition without holding the lock
freebsd9 is the only platform that apparently cares about this.
Diffstat (limited to 'assoc.c')
-rw-r--r--assoc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/assoc.c b/assoc.c
index 0edce2b..0fc5d18 100644
--- a/assoc.c
+++ b/assoc.c
@@ -244,9 +244,10 @@ static void *assoc_maintenance_thread(void *arg) {
if (!expanding) {
/* finished expanding. tell all threads to use fine-grained locks */
switch_item_lock_type(ITEM_LOCK_GRANULAR);
- started_expanding = false;
slabs_rebalancer_resume();
/* We are done expanding.. just wait for next invocation */
+ mutex_lock(&cache_lock);
+ started_expanding = false;
pthread_cond_wait(&maintenance_cond, &cache_lock);
/* Before doing anything, tell threads to use a global lock */
mutex_unlock(&cache_lock);