mirror of
https://github.com/GOSTSec/ccminer
synced 2025-01-08 22:07:56 +00:00
reduce crashes on debug tests
This commit is contained in:
parent
d7c2168f2b
commit
e4476a5eee
9
api.cpp
9
api.cpp
@ -995,7 +995,7 @@ void *api_thread(void *userdata)
|
||||
/* to be able to report the default value set in each algo */
|
||||
void api_set_throughput(int thr_id, uint32_t throughput)
|
||||
{
|
||||
if (thr_id < MAX_GPUS) {
|
||||
if (thr_id < MAX_GPUS && thr_info) {
|
||||
struct cgpu_info *cgpu = &thr_info[thr_id].gpu;
|
||||
uint32_t ws = throughput;
|
||||
uint8_t i = 0;
|
||||
@ -1007,9 +1007,8 @@ void api_set_throughput(int thr_id, uint32_t throughput)
|
||||
if (i && (1U << i) < throughput) {
|
||||
cgpu->intensity += ((float) (throughput-(1U << i)) / (1U << i));
|
||||
}
|
||||
|
||||
// to display in bench results
|
||||
if (opt_benchmark)
|
||||
bench_set_throughput(thr_id, throughput);
|
||||
}
|
||||
// to display in bench results
|
||||
if (opt_benchmark)
|
||||
bench_set_throughput(thr_id, throughput);
|
||||
}
|
||||
|
13
ccminer.cpp
13
ccminer.cpp
@ -167,7 +167,7 @@ pthread_mutex_t stratum_work_lock;
|
||||
char *opt_cert;
|
||||
char *opt_proxy;
|
||||
long opt_proxy_type;
|
||||
struct thr_info *thr_info;
|
||||
struct thr_info *thr_info = NULL;
|
||||
static int work_thr_id;
|
||||
struct thr_api *thr_api;
|
||||
int longpoll_thr_id = -1;
|
||||
@ -473,6 +473,7 @@ void get_currentalgo(char* buf, int sz)
|
||||
*/
|
||||
void proper_exit(int reason)
|
||||
{
|
||||
restart_threads();
|
||||
if (abort_flag) /* already called */
|
||||
return;
|
||||
|
||||
@ -3042,10 +3043,13 @@ int main(int argc, char *argv[])
|
||||
rpc_user = strdup("");
|
||||
rpc_pass = strdup("");
|
||||
rpc_url = strdup("");
|
||||
|
||||
jane_params = strdup("");
|
||||
|
||||
pthread_mutex_init(&applog_lock, NULL);
|
||||
pthread_mutex_init(&stratum_sock_lock, NULL);
|
||||
pthread_mutex_init(&stratum_work_lock, NULL);
|
||||
pthread_mutex_init(&stats_lock, NULL);
|
||||
pthread_mutex_init(&g_work_lock, NULL);
|
||||
|
||||
// number of cpus for thread affinity
|
||||
#if defined(WIN32)
|
||||
@ -3114,11 +3118,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* init stratum data.. */
|
||||
memset(&stratum.url, 0, sizeof(stratum));
|
||||
pthread_mutex_init(&stratum_sock_lock, NULL);
|
||||
pthread_mutex_init(&stratum_work_lock, NULL);
|
||||
|
||||
pthread_mutex_init(&stats_lock, NULL);
|
||||
pthread_mutex_init(&g_work_lock, NULL);
|
||||
|
||||
// ensure default params are set
|
||||
pool_init_defaults();
|
||||
|
Loading…
Reference in New Issue
Block a user