diff --git a/src/bio.c b/src/bio.c index 0c92d053bcd254189bddb3083778ffeaabf909d6..0e15c416dfa391d13cd64b66856a2d52bdedeeb2 100644 --- a/src/bio.c +++ b/src/bio.c @@ -204,14 +204,14 @@ void *bioProcessBackgroundJobs(void *arg) { } zfree(job); - /* Unblock threads blocked on bioWaitStepOfType() if any. */ - pthread_cond_broadcast(&bio_step_cond[type]); - /* Lock again before reiterating the loop, if there are no longer * jobs to process we'll block again in pthread_cond_wait(). */ pthread_mutex_lock(&bio_mutex[type]); listDelNode(bio_jobs[type],ln); bio_pending[type]--; + + /* Unblock threads blocked on bioWaitStepOfType() if any. */ + pthread_cond_broadcast(&bio_step_cond[type]); } }