Browse Source

Wait till the avalon_send_tasks thread has filled the avalon with idle work before starting the avalon_get_results thread.

Con Kolivas 12 years ago
parent
commit
0763070cb0
1 changed files with 5 additions and 1 deletions
  1. 5 1
      driver-avalon.c

+ 5 - 1
driver-avalon.c

@@ -703,7 +703,7 @@ static void *avalon_send_tasks(void *userdata)
 		for (i = start_count, j = 0; i < end_count; i++, j++) {
 		for (i = start_count, j = 0; i < end_count; i++, j++) {
 			if (unlikely(avalon_buffer_full(fd) == AVA_BUFFER_FULL)) {
 			if (unlikely(avalon_buffer_full(fd) == AVA_BUFFER_FULL)) {
 				applog(LOG_WARNING,
 				applog(LOG_WARNING,
-				       "AVA%i: Buffer full before all  work queued",
+				       "AVA%i: Buffer full before all work queued",
 					avalon->device_id);
 					avalon->device_id);
 				break;
 				break;
 			}
 			}
@@ -765,6 +765,10 @@ static bool avalon_prepare(struct thr_info *thr)
 	if (pthread_create(&info->read_thr, NULL, avalon_get_results, (void *)avalon))
 	if (pthread_create(&info->read_thr, NULL, avalon_get_results, (void *)avalon))
 		quit(1, "Failed to create avalon read_thr");
 		quit(1, "Failed to create avalon read_thr");
 
 
+	mutex_lock(&info->qlock);
+	pthread_cond_wait(&info->qcond, &info->qlock);
+	mutex_unlock(&info->qlock);
+
 	avalon_init(avalon);
 	avalon_init(avalon);
 
 
 	cgtime(&now);
 	cgtime(&now);