Browse Source

Merge commit 'b3cfe47' into bfgminer

Luke Dashjr 13 years ago
parent
commit
2d6259c290
1 changed files with 7 additions and 1 deletions
  1. 7 1
      miner.c

+ 7 - 1
miner.c

@@ -2227,7 +2227,9 @@ static struct work *make_work(void)
 
 	if (unlikely(!work))
 		quit(1, "Failed to calloc work in make_work");
+	mutex_lock(&control_lock);
 	work->id = total_work++;
+	mutex_unlock(&control_lock);
 	return work;
 }
 
@@ -2604,11 +2606,15 @@ retry:
 		if (ts <= opt_queue)
 			lagging = true;
 		pool = ret_work->pool = select_pool(lagging);
-		inc_queued();
 
 		if (!ce)
 			ce = pop_curl_entry(pool);
 
+		/* Inc queued count after ce is popped in case there're none
+		 * left and we think we've queued work when we're just waiting
+		 * for curls */
+		inc_queued();
+
 		/* obtain new work from bitcoin via JSON-RPC */
 		if (!get_upstream_work(ret_work, ce->curl)) {
 			/* pause, then restart work-request loop */