Commit 0a9d7ca6b303b7c6abc5f974e23b474765ed900b

Con Kolivas 2013-05-26T16:46:43

Implement an avalon_flush_work function for work restarts.

diff --git a/driver-avalon.c b/driver-avalon.c
index b7e660e..06a15c7 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -967,6 +967,19 @@ static int64_t avalon_scanhash(struct thr_info *thr)
 	return hash_count;
 }
 
+static void avalon_flush_work(struct cgpu_info *avalon)
+{
+	struct avalon_info *info = avalon->device_data;
+	struct thr_info *thr = info->thr;
+
+	mutex_lock(&info->qlock);
+	avalon_rotate_array(avalon);
+	pthread_cond_signal(&info->qcond);
+	mutex_unlock(&info->qlock);
+
+	thr->work_restart = false;
+}
+
 static struct api_data *avalon_api_stats(struct cgpu_info *cgpu)
 {
 	struct api_data *root = NULL;
@@ -1013,6 +1026,7 @@ struct device_drv avalon_drv = {
 	.hash_work = hash_queued_work,
 	.queue_full = avalon_fill,
 	.scanwork = avalon_scanhash,
+	.flush_work = avalon_flush_work,
 	.get_api_stats = avalon_api_stats,
 	.reinit_device = avalon_init,
 	.thread_shutdown = avalon_shutdown,