From 9d635fa7f46f000d23663e0be3a900d2c51a3ed8 Mon Sep 17 00:00:00 2001 From: dormando Date: Sat, 19 Apr 2014 12:15:29 -0700 Subject: [PATCH 1/2] don't drop to a condition without holding the lock I am a moran. How do you even thread. --- items.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/items.c b/items.c index 688ad03..3e2f71f 100644 --- a/items.c +++ b/items.c @@ -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) { @@ -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"); -- 1.9.2