Browse Source

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

djm34
Jan Berdajs 11 years ago
parent
commit
2877e8d49c
  1. 11
      sgminer.c

11
sgminer.c

@ -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) { if (mining_thr) {
for (i = 0; i < total_devices; ++i) { for (i = 0; i < total_devices; ++i) {
free(devices[i]->thr); free(devices[i]->thr);
@ -7785,10 +7786,13 @@ static void restart_mining_threads(unsigned int new_n_threads)
cgtime(&thr->last); cgtime(&thr->last);
cgpu->thr[j] = thr; 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) { for (i = 0; i < total_devices; ++i) {
struct cgpu_info *cgpu = 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) { for (j = 0; j < cgpu->threads; ++j) {
thr = cgpu->thr[j]; thr = cgpu->thr[j];
if (!cgpu->drv->thread_prepare(thr))
continue;
if (unlikely(thr_info_create(thr, NULL, miner_thread, thr))) if (unlikely(thr_info_create(thr, NULL, miner_thread, thr)))
quit(1, "thread %d create failed", thr->id); quit(1, "thread %d create failed", thr->id);

Loading…
Cancel
Save