From 92deefcbca269ef0fda6539fc102b392d1871649 Mon Sep 17 00:00:00 2001 From: Jan Berdajs Date: Tue, 1 Jul 2014 01:19:07 +0200 Subject: [PATCH] Fix bad lock --- sgminer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sgminer.c b/sgminer.c index 8c13f16a..f35eff4c 100644 --- a/sgminer.c +++ b/sgminer.c @@ -486,13 +486,13 @@ static FILE *sharelog_file = NULL; static struct cgpu_info *get_thr_cgpu(int thr_id) { - struct thr_info *thr = NULL; + struct cgpu_info *cgpu = NULL; rd_lock(&mining_thr_lock); - if (thr_id < mining_threads) - thr = mining_thr[thr_id]; + if (thr_id < mining_threads && mining_thr[thr_id]) + cgpu = mining_thr[thr_id]->cgpu; rd_unlock(&mining_thr_lock); - return thr ? thr->cgpu : NULL; + return cgpu; } struct cgpu_info *get_devices(int id)