Commit 8897e0657507072448f4e951ce1caadca15b4b30

ckolivas 2012-08-07T11:05:23

Only add to the pool curlring and increment the counter under mutex lock.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/cgminer.c b/cgminer.c
index c78e46f..d73ecac 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -2185,8 +2185,10 @@ static void recruit_curl(struct pool *pool)
 	if (unlikely(!ce->curl || !ce))
 		quit(1, "Failed to init in recruit_curl");
 
+	mutex_lock(&pool->pool_lock);
 	list_add(&ce->node, &pool->curlring);
 	pool->curls++;
+	mutex_unlock(&pool->pool_lock);
 	applog(LOG_DEBUG, "Recruited curl %d for pool %d", pool->curls, pool->pool_no);
 }