Browse Source

check work restart status in miner thread

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

Loading…
Cancel
Save