Browse Source

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

Con Kolivas 13 years ago
parent
commit
0316592b95
1 changed files with 6 additions and 3 deletions
  1. 6 3
      driver-avalon.c

+ 6 - 3
driver-avalon.c

@@ -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);