1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-02-02 01:44:23 +00:00

of course it needs to be a write lock! fixes segfault

This commit is contained in:
Jan Berdajs 2014-06-09 17:02:14 +02:00
parent d1f7ef6133
commit 2877e8d49c

View File

@ -7744,7 +7744,8 @@ static void restart_mining_threads(unsigned int new_n_threads)
}
}
rd_lock(&mining_thr_lock);
wr_lock(&mining_thr_lock);
if (mining_thr) {
for (i = 0; i < total_devices; ++i) {
free(devices[i]->thr);
@ -7785,10 +7786,13 @@ static void restart_mining_threads(unsigned int new_n_threads)
cgtime(&thr->last);
cgpu->thr[j] = thr;
if (!cgpu->drv->thread_prepare(thr))
continue;
}
}
rd_unlock(&mining_thr_lock);
wr_unlock(&mining_thr_lock);
for (i = 0; i < total_devices; ++i) {
struct cgpu_info *cgpu = devices[i];
@ -7796,9 +7800,6 @@ static void restart_mining_threads(unsigned int new_n_threads)
for (j = 0; j < cgpu->threads; ++j) {
thr = cgpu->thr[j];
if (!cgpu->drv->thread_prepare(thr))
continue;
if (unlikely(thr_info_create(thr, NULL, miner_thread, thr)))
quit(1, "thread %d create failed", thr->id);