mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Check for thr->work_restart in restart_wait.
This commit is contained in:
parent
89f571f527
commit
a61e41a070
@ -3590,7 +3590,7 @@ static void discard_stale(void)
|
||||
* work restart is required. Returns the value of pthread_cond_timedwait
|
||||
* which is zero if the condition was met or ETIMEDOUT if not.
|
||||
*/
|
||||
int restart_wait(unsigned int mstime)
|
||||
int restart_wait(struct thr_info *thr, unsigned int mstime)
|
||||
{
|
||||
struct timeval now, then, tdiff;
|
||||
struct timespec abstime;
|
||||
@ -3604,7 +3604,10 @@ int restart_wait(unsigned int mstime)
|
||||
abstime.tv_nsec = then.tv_usec * 1000;
|
||||
|
||||
mutex_lock(&restart_lock);
|
||||
rc = pthread_cond_timedwait(&restart_cond, &restart_lock, &abstime);
|
||||
if (thr->work_restart)
|
||||
rc = ETIMEDOUT;
|
||||
else
|
||||
rc = pthread_cond_timedwait(&restart_cond, &restart_lock, &abstime);
|
||||
mutex_unlock(&restart_lock);
|
||||
|
||||
return rc;
|
||||
|
@ -1740,7 +1740,7 @@ static int64_t bflsc_scanwork(struct thr_info *thr)
|
||||
}
|
||||
}
|
||||
|
||||
waited = restart_wait(sc_info->scan_sleep_time);
|
||||
waited = restart_wait(thr, sc_info->scan_sleep_time);
|
||||
if (waited == ETIMEDOUT) {
|
||||
unsigned int old_sleep_time, new_sleep_time = 0;
|
||||
int min_queued = sc_info->que_size;
|
||||
|
@ -678,7 +678,7 @@ static int64_t bitforce_scanhash(struct thr_info *thr, struct work *work, int64_
|
||||
|
||||
send_ret = bitforce_send_work(thr, work);
|
||||
|
||||
if (!restart_wait(bitforce->sleep_ms))
|
||||
if (!restart_wait(thr, bitforce->sleep_ms))
|
||||
return 0;
|
||||
|
||||
bitforce->wait_ms = bitforce->sleep_ms;
|
||||
|
2
miner.h
2
miner.h
@ -945,7 +945,7 @@ extern pthread_cond_t restart_cond;
|
||||
extern void thread_reportin(struct thr_info *thr);
|
||||
extern void clear_stratum_shares(struct pool *pool);
|
||||
extern void set_target(unsigned char *dest_target, double diff);
|
||||
extern int restart_wait(unsigned int mstime);
|
||||
extern int restart_wait(struct thr_info *thr, unsigned int mstime);
|
||||
|
||||
extern void kill_work(void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user