1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-11 07:17:58 +00:00

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

This commit is contained in:
Con Kolivas 2013-05-27 17:48:54 +10:00
parent 6ce6cd547e
commit 0316592b95

View File

@ -877,16 +877,19 @@ static bool avalon_prepare(struct thr_info *thr)
if (unlikely(pthread_cond_init(&info->qcond, NULL)))
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))
quit(1, "Failed to create avalon write_thr");
mutex_lock(&info->qlock);
info->reset = false;
pthread_cond_wait(&info->qcond, &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);
cgtime(&now);