Browse Source

reduce crashes on debug tests

2upstream
Tanguy Pruvot 9 years ago
parent
commit
e4476a5eee
  1. 9
      api.cpp
  2. 13
      ccminer.cpp
  3. 2
      cuda.cpp

9
api.cpp

@ -995,7 +995,7 @@ void *api_thread(void *userdata) @@ -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) @@ -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

@ -167,7 +167,7 @@ pthread_mutex_t stratum_work_lock; @@ -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) @@ -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[]) @@ -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[]) @@ -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();

2
cuda.cpp

@ -229,6 +229,8 @@ typedef struct { double value[8]; } tsumarray; @@ -229,6 +229,8 @@ typedef struct { double value[8]; } tsumarray;
cudaError_t MyStreamSynchronize(cudaStream_t stream, int situation, int thr_id)
{
cudaError_t result = cudaSuccess;
if (abort_flag)
return result;
if (situation >= 0)
{
static std::map<int, tsumarray> tsum;

Loading…
Cancel
Save