Commit 5bf9856a4aebab98499b5ea7224523d2314483d1

Con Kolivas 2013-09-03T11:38:58

take_queued_work_bymidstate should use a write lock.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/cgminer.c b/cgminer.c
index fc611a4..3b9e3ba 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -6178,11 +6178,11 @@ struct work *take_queued_work_bymidstate(struct cgpu_info *cgpu, char *midstate,
 {
 	struct work *work;
 
-	rd_lock(&cgpu->qlock);
+	wr_lock(&cgpu->qlock);
 	work = __find_work_bymidstate(cgpu->queued_work, midstate, midstatelen, data, offset, datalen);
 	if (work)
 		__work_completed(cgpu, work);
-	rd_unlock(&cgpu->qlock);
+	wr_unlock(&cgpu->qlock);
 
 	return work;
 }