Commit fa9e03f487f6eb457c7c52211b17981a4fae51ad

Con Kolivas 2011-07-20T13:48:23

Implement pool rotation strategy.

diff --git a/main.c b/main.c
index 6aae382..efbd637 100644
--- a/main.c
+++ b/main.c
@@ -2384,11 +2384,13 @@ static bool active_device(int thr_id)
 static void *watchdog_thread(void *userdata)
 {
 	const unsigned int interval = opt_log_interval / 2 ? : 1;
+	static struct timeval rotate_tv;
 	struct timeval zero_tv;
 
 	pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
 
 	memset(&zero_tv, 0, sizeof(struct timeval));
+	gettimeofday(&rotate_tv, NULL);
 
 	while (1) {
 		int x, y, logx, logy, i;
@@ -2435,6 +2437,11 @@ static void *watchdog_thread(void *userdata)
 			}
 		}
 
+		if (pool_strategy == POOL_ROTATE && now.tv_sec - rotate_tv.tv_sec > 60 * opt_rotate_period) {
+			gettimeofday(&rotate_tv, NULL);
+			switch_pools();
+		}
+
 		//for (i = 0; i < mining_threads; i++) {
 		for (i = 0; i < gpu_threads; i++) {
 			struct thr_info *thr = &thr_info[i];