Skip to content

Commit

Permalink
don't wait on condition without holding the lock
Browse files Browse the repository at this point in the history
freebsd9 is the only platform that apparently cares about this.
  • Loading branch information
dormando committed Sep 3, 2012
1 parent 0adbf81 commit 8963836
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion assoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8963836

Please sign in to comment.