Browse Source

Merge commit 'ae78270' into bfgminer-2.10.x

Luke Dashjr 13 years ago
parent
commit
2ba2f3b2a1
1 changed files with 10 additions and 0 deletions
  1. 10 0
      miner.c

+ 10 - 0
miner.c

@@ -6130,6 +6130,7 @@ static struct work *hash_pop(void)
 	struct work *work = NULL, *tmp;
 	int hc;
 
+retry:
 	mutex_lock(stgd_lock);
 	while (!getq->frozen && !HASH_COUNT(staged_work))
 		pthread_cond_wait(&getq->cond, stgd_lock);
@@ -6143,6 +6144,15 @@ static struct work *hash_pop(void)
 		}
 	} else
 		work = staged_work;
+	
+	if (can_roll(work) && should_roll(work))
+	{
+		// Instead of consuming it, force it to be cloned and grab the clone
+		mutex_unlock(stgd_lock);
+		clone_available();
+		goto retry;
+	}
+	
 	HASH_DEL(staged_work, work);
 	if (work_rollable(work))
 		staged_rollable--;