Browse Source

check work restart status in miner thread

also reduce a bit possible duplicate shares...
2upstream
Tanguy Pruvot 10 years ago
parent
commit
e791039592
  1. 24
      ccminer.cpp

24
ccminer.cpp

@ -1614,7 +1614,7 @@ static void *miner_thread(void *userdata) @@ -1614,7 +1614,7 @@ static void *miner_thread(void *userdata)
memcpy(work.target, g_work.target, sizeof(work.target));
work.difficulty = g_work.difficulty;
work.height = g_work.height;
nonceptr[0] = (UINT32_MAX / opt_n_threads) * thr_id; // 0 if single thr
//nonceptr[0] = (UINT32_MAX / opt_n_threads) * thr_id; // 0 if single thr
}
if (opt_algo == ALGO_ZR5) {
@ -1640,9 +1640,14 @@ static void *miner_thread(void *userdata) @@ -1640,9 +1640,14 @@ static void *miner_thread(void *userdata)
} else
nonceptr[0]++; //??
work_restart[thr_id].restart = 0;
pthread_mutex_unlock(&g_work_lock);
/* prevent gpu scans before a job is received */
if (have_stratum && work.data[0] == 0) {
sleep(1); pools[cur_pooln].wait_time += 1;
continue;
}
/* conditional mining */
if (!wanna_mine(thr_id)) {
@ -1664,11 +1669,7 @@ static void *miner_thread(void *userdata) @@ -1664,11 +1669,7 @@ static void *miner_thread(void *userdata)
continue;
}
/* prevent gpu scans before a job is received */
if (have_stratum && work.data[0] == 0) {
sleep(1); pools[cur_pooln].wait_time += 1;
continue;
}
work_restart[thr_id].restart = 0;
/* adjust max_nonce to meet target scan time */
if (have_stratum)
@ -1945,6 +1946,12 @@ static void *miner_thread(void *userdata) @@ -1945,6 +1946,12 @@ static void *miner_thread(void *userdata)
goto out;
}
if (abort_flag)
break; // time to leave the mining loop...
if (work_restart[thr_id].restart)
continue;
/* record scanhash elapsed time */
gettimeofday(&tv_end, NULL);
@ -1991,9 +1998,6 @@ static void *miner_thread(void *userdata) @@ -1991,9 +1998,6 @@ static void *miner_thread(void *userdata)
}
}
if (abort_flag)
break; // time to leave the mining loop...
if (check_dups)
hashlog_remember_scan_range(&work);

Loading…
Cancel
Save