blob: f6767362f665d0a2dea8b99af91d01b75b83f6d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
From d8b1047620a54443f6bdca7f0dc5ee3b4d99378e Mon Sep 17 00:00:00 2001
From: dormando <dormando@rydia.net>
Date: Sat, 19 Apr 2014 16:03:28 -0700
Subject: [PATCH 2/2] flag crawler as running during the request to run
... so there's no race to tell if it's running if you check after the command
exits.
---
items.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/items.c b/items.c
index 3e2f71f..6261503 100644
--- a/items.c
+++ b/items.c
@@ -769,9 +769,6 @@ static void *item_crawler_thread(void *arg) {
fprintf(stderr, "Starting LRU crawler background thread\n");
while (do_run_lru_crawler_thread) {
pthread_cond_wait(&lru_crawler_cond, &lru_crawler_lock);
- STATS_LOCK();
- stats.lru_crawler_running = true;
- STATS_UNLOCK();
while (crawler_count) {
item *search = NULL;
@@ -918,6 +915,9 @@ enum crawler_result_type lru_crawler_crawl(char *slabs) {
}
pthread_mutex_unlock(&cache_lock);
pthread_cond_signal(&lru_crawler_cond);
+ STATS_LOCK();
+ stats.lru_crawler_running = true;
+ STATS_UNLOCK();
pthread_mutex_unlock(&lru_crawler_lock);
return CRAWLER_OK;
}
--
1.9.2
|