Browse Source

Semi-Merge commit '9fd60bb' into cg_merges_20121226 (just add checking staged_rollable inside stgd_lock)

(undetected conflicts in miner.c)
Luke Dashjr 13 years ago
parent
commit
38f4659fb5
1 changed files with 4 additions and 3 deletions
  1. 4 3
      miner.c

+ 4 - 3
miner.c

@@ -3343,10 +3343,10 @@ static bool clone_available(void)
 	struct work *work_clone;
 	bool cloned = false;
 
+	mutex_lock(stgd_lock);
 	if (!staged_rollable)
-		goto out;
+		goto out_unlock;
 
-	mutex_lock(stgd_lock);
 	HASH_ITER(hh, staged_work, work, tmp) {
 		if (can_roll(work) && should_roll(work)) {
 			roll_work(work);
@@ -3356,6 +3356,8 @@ static bool clone_available(void)
 			break;
 		}
 	}
+
+out_unlock:
 	mutex_unlock(stgd_lock);
 
 	if (cloned) {
@@ -3363,7 +3365,6 @@ static bool clone_available(void)
 		stage_work(work_clone);
 	}
 
-out:
 	return cloned;
 }