Browse Source

Spawn the avalon read thread first with info->reset set to discard any data till work is adequately queued.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
0316592b95
  1. 9
      driver-avalon.c

9
driver-avalon.c

@ -877,16 +877,19 @@ static bool avalon_prepare(struct thr_info *thr)
if (unlikely(pthread_cond_init(&info->qcond, NULL))) if (unlikely(pthread_cond_init(&info->qcond, NULL)))
quit(1, "Failed to pthread_cond_init avalon qcond"); quit(1, "Failed to pthread_cond_init avalon qcond");
info->reset = true;
if (pthread_create(&info->read_thr, NULL, avalon_get_results, (void *)avalon))
quit(1, "Failed to create avalon read_thr");
if (pthread_create(&info->write_thr, NULL, avalon_send_tasks, (void *)avalon)) if (pthread_create(&info->write_thr, NULL, avalon_send_tasks, (void *)avalon))
quit(1, "Failed to create avalon write_thr"); quit(1, "Failed to create avalon write_thr");
mutex_lock(&info->qlock); mutex_lock(&info->qlock);
info->reset = false;
pthread_cond_wait(&info->qcond, &info->qlock); pthread_cond_wait(&info->qcond, &info->qlock);
mutex_unlock(&info->qlock); mutex_unlock(&info->qlock);
if (pthread_create(&info->read_thr, NULL, avalon_get_results, (void *)avalon))
quit(1, "Failed to create avalon read_thr");
avalon_init(avalon); avalon_init(avalon);
cgtime(&now); cgtime(&now);

Loading…
Cancel
Save