From 2b932ccb8187338f2fecc2610baf96af1b66b66d Mon Sep 17 00:00:00 2001 From: Chris Chua Date: Fri, 16 Aug 2013 16:37:43 +0000 Subject: [PATCH] changes to queueing strategy for BitBurner boards --- driver-avalon.c | 9 +++++++++ driver-avalon.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/driver-avalon.c b/driver-avalon.c index 36d4fc77..b47bff66 100644 --- a/driver-avalon.c +++ b/driver-avalon.c @@ -1016,6 +1016,15 @@ static void *avalon_send_tasks(void *userdata) mutex_unlock(&info->lock); } + if (usb_ident(avalon) == IDENT_BTB) { + // Give other threads the chance to acquire qlock + i = 0; + do { + nmsleep(40); + } while (!avalon->shutdown && i++ < 15 + && avalon->queued < avalon_get_work_count); + } + mutex_lock(&info->qlock); start_count = avalon->work_array * avalon_get_work_count; end_count = start_count + avalon_get_work_count; diff --git a/driver-avalon.h b/driver-avalon.h index 562483b1..116e80fe 100644 --- a/driver-avalon.h +++ b/driver-avalon.h @@ -146,7 +146,7 @@ struct avalon_info { #define AVALON_WRITE_SIZE (sizeof(struct avalon_task)) #define AVALON_READ_SIZE (sizeof(struct avalon_result)) -#define AVALON_ARRAY_SIZE 3 +#define AVALON_ARRAY_SIZE 4 #define AVA_GETS_ERROR -1 #define AVA_GETS_OK 0