Browse Source

Check for thr->work_restart in restart_wait.

nfactor-troky
Con Kolivas 11 years ago
parent
commit
a61e41a070
  1. 5
      cgminer.c
  2. 2
      driver-bflsc.c
  3. 2
      driver-bitforce.c
  4. 2
      miner.h

5
cgminer.c

@ -3590,7 +3590,7 @@ static void discard_stale(void) @@ -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,6 +3604,9 @@ int restart_wait(unsigned int mstime) @@ -3604,6 +3604,9 @@ int restart_wait(unsigned int mstime)
abstime.tv_nsec = then.tv_usec * 1000;
mutex_lock(&restart_lock);
if (thr->work_restart)
rc = ETIMEDOUT;
else
rc = pthread_cond_timedwait(&restart_cond, &restart_lock, &abstime);
mutex_unlock(&restart_lock);

2
driver-bflsc.c

@ -1740,7 +1740,7 @@ static int64_t bflsc_scanwork(struct thr_info *thr) @@ -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;

2
driver-bitforce.c

@ -678,7 +678,7 @@ static int64_t bitforce_scanhash(struct thr_info *thr, struct work *work, int64_ @@ -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

@ -945,7 +945,7 @@ extern pthread_cond_t restart_cond; @@ -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…
Cancel
Save