Browse Source

Revert "Remove bitforce_thread_init"

This reverts commit 2dfe0d628e05763bce09c51420860ef4f2ea7919.

Roll back to init'ing bitforce devices at regular intervals. They may reinit more than previously thought.
Con Kolivas 13 years ago
parent
commit
a688951d37
1 changed files with 15 additions and 0 deletions
  1. 15 0
      driver-bitforce.c

+ 15 - 0
driver-bitforce.c

@@ -525,6 +525,20 @@ static bool bitforce_get_stats(struct cgpu_info *bitforce)
 	return bitforce_get_temp(bitforce);
 	return bitforce_get_temp(bitforce);
 }
 }
 
 
+static bool bitforce_thread_init(struct thr_info *thr)
+{
+	struct cgpu_info *bitforce = thr->cgpu;
+	unsigned int wait;
+
+	/* Pause each new thread a random time between 0-100ms 
+	so the devices aren't making calls all at the same time. */
+	wait = (rand() * MAX_START_DELAY_US)/RAND_MAX;
+	applog(LOG_DEBUG, "BFL%i: Delaying start by %dms", bitforce->device_id, wait / 1000);
+	usleep(wait);
+
+	return true;
+}
+
 static struct api_data *bitforce_api_stats(struct cgpu_info *cgpu)
 static struct api_data *bitforce_api_stats(struct cgpu_info *cgpu)
 {
 {
 	struct api_data *root = NULL;
 	struct api_data *root = NULL;
@@ -548,6 +562,7 @@ struct device_api bitforce_api = {
 	.get_statline_before = get_bitforce_statline_before,
 	.get_statline_before = get_bitforce_statline_before,
 	.get_stats = bitforce_get_stats,
 	.get_stats = bitforce_get_stats,
 	.thread_prepare = bitforce_thread_prepare,
 	.thread_prepare = bitforce_thread_prepare,
+	.thread_init = bitforce_thread_init,
 	.scanhash = bitforce_scanhash,
 	.scanhash = bitforce_scanhash,
 	.thread_shutdown = bitforce_shutdown,
 	.thread_shutdown = bitforce_shutdown,
 	.thread_enable = biforce_thread_enable
 	.thread_enable = biforce_thread_enable