mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-14 16:58:05 +00:00
just in case, read-lock devices
This commit is contained in:
parent
9fdd23e6ff
commit
2ea8f5d018
@ -1218,7 +1218,6 @@ static bool opencl_thread_prepare(struct thr_info *thr)
|
|||||||
char name[256];
|
char name[256];
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
struct cgpu_info *cgpu = thr->cgpu;
|
struct cgpu_info *cgpu = thr->cgpu;
|
||||||
struct opencl_thread_data *thrdata = (struct opencl_thread_data *)thr->cgpu_data;
|
|
||||||
int gpu = cgpu->device_id;
|
int gpu = cgpu->device_id;
|
||||||
int virtual_gpu = cgpu->virtual_gpu;
|
int virtual_gpu = cgpu->virtual_gpu;
|
||||||
int i = thr->id;
|
int i = thr->id;
|
||||||
|
@ -405,7 +405,7 @@ static FILE *sharelog_file = NULL;
|
|||||||
|
|
||||||
static struct cgpu_info *get_thr_cgpu(int thr_id)
|
static struct cgpu_info *get_thr_cgpu(int thr_id)
|
||||||
{
|
{
|
||||||
struct thr_info *thr;
|
struct thr_info *thr = NULL;
|
||||||
rd_lock(&mining_thr_lock);
|
rd_lock(&mining_thr_lock);
|
||||||
if (thr_id < mining_threads)
|
if (thr_id < mining_threads)
|
||||||
thr = mining_thr[thr_id];
|
thr = mining_thr[thr_id];
|
||||||
@ -4029,7 +4029,7 @@ static void *restart_thread(void __maybe_unused *arg)
|
|||||||
{
|
{
|
||||||
struct pool *cp = current_pool();
|
struct pool *cp = current_pool();
|
||||||
struct cgpu_info *cgpu;
|
struct cgpu_info *cgpu;
|
||||||
int i, mt;
|
int i;
|
||||||
|
|
||||||
pthread_detach(pthread_self());
|
pthread_detach(pthread_self());
|
||||||
|
|
||||||
@ -7767,6 +7767,7 @@ static void restart_mining_threads(unsigned int new_n_threads)
|
|||||||
quit(1, "Failed to calloc mining_thr[%d]", i);
|
quit(1, "Failed to calloc mining_thr[%d]", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rd_lock(&devices_lock);
|
||||||
// Start threads
|
// Start threads
|
||||||
k = 0;
|
k = 0;
|
||||||
for (i = 0; i < total_devices; ++i) {
|
for (i = 0; i < total_devices; ++i) {
|
||||||
@ -7788,9 +7789,10 @@ static void restart_mining_threads(unsigned int new_n_threads)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
rd_unlock(&devices_lock);
|
||||||
wr_unlock(&mining_thr_lock);
|
wr_unlock(&mining_thr_lock);
|
||||||
|
|
||||||
|
rd_lock(&devices_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];
|
||||||
|
|
||||||
@ -7808,6 +7810,7 @@ static void restart_mining_threads(unsigned int new_n_threads)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
rd_unlock(&devices_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *restart_mining_threads_thread(void *userdata)
|
static void *restart_mining_threads_thread(void *userdata)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user