Skip to content

Commit

Permalink
don't drop to a condition without holding the lock
Browse files Browse the repository at this point in the history
I am a moran. How do you even thread.
  • Loading branch information
dormando committed Apr 19, 2014
1 parent d7324b0 commit 9d635fa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion items.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,7 @@ static void item_crawler_evaluate(item *search, uint32_t hv, int i) {
static void *item_crawler_thread(void *arg) {
int i;

pthread_mutex_lock(&lru_crawler_lock);
if (settings.verbose > 2)
fprintf(stderr, "Starting LRU crawler background thread\n");
while (do_run_lru_crawler_thread) {
Expand Down Expand Up @@ -827,8 +828,8 @@ static void *item_crawler_thread(void *arg) {
STATS_LOCK();
stats.lru_crawler_running = false;
STATS_UNLOCK();
pthread_mutex_unlock(&lru_crawler_lock);
}
pthread_mutex_unlock(&lru_crawler_lock);
if (settings.verbose > 2)
fprintf(stderr, "LRU crawler thread stopping\n");

Expand Down

0 comments on commit 9d635fa

Please sign in to comment.