Browse Source

Remove getwork command from workio_cmd queues and do them directly from queue_request.

Con Kolivas 13 years ago
parent
commit
59ddfd07a7
1 changed files with 4 additions and 41 deletions
  1. 4 41
      cgminer.c

+ 4 - 41
cgminer.c

@@ -62,12 +62,7 @@
 #	define USE_FPGA
 #endif
 
-enum workio_commands {
-	WC_GET_WORK,
-};
-
 struct workio_cmd {
-	enum workio_commands	cmd;
 	struct thr_info		*thr;
 	struct work		*work;
 	struct pool		*pool;
@@ -2735,11 +2730,6 @@ static void workio_cmd_free(struct workio_cmd *wc)
 	if (!wc)
 		return;
 
-	switch (wc->cmd) {
-		default: /* do nothing */
-			break;
-	}
-
 	memset(wc, 0, sizeof(*wc));	/* poison */
 	free(wc);
 }
@@ -3207,20 +3197,6 @@ out:
 	return NULL;
 }
 
-/* As per the submit work system, we try to reuse the existing curl handles,
- * but start recruiting extra connections if we start accumulating queued
- * requests */
-static bool workio_get_work(struct workio_cmd *wc)
-{
-	pthread_t get_thread;
-
-	if (unlikely(pthread_create(&get_thread, NULL, get_work_thread, (void *)wc))) {
-		applog(LOG_ERR, "Failed to create get_work_thread");
-		return false;
-	}
-	return true;
-}
-
 static bool stale_work(struct work *work, bool share)
 {
 	struct timeval now;
@@ -4455,16 +4431,6 @@ static void *workio_thread(void *userdata)
 			ok = false;
 			break;
 		}
-
-		/* process workio_cmd */
-		switch (wc->cmd) {
-		case WC_GET_WORK:
-			ok = workio_get_work(wc);
-			break;
-		default:
-			ok = false;
-			break;
-		}
 	}
 
 	tq_freeze(mythr->q);
@@ -5071,6 +5037,7 @@ static bool queue_request(void)
 	int ts, tq, maxq = opt_queue + mining_threads;
 	struct pool *pool, *cp;
 	struct workio_cmd *wc;
+	pthread_t get_thread;
 	bool lagging;
 
 	ts = total_staged();
@@ -5096,17 +5063,13 @@ static bool queue_request(void)
 		return false;
 	}
 
-	wc->cmd = WC_GET_WORK;
 	wc->pool = pool;
 
 	applog(LOG_DEBUG, "Queueing getwork request to work thread");
 
-	/* send work request to workio thread */
-	if (unlikely(!tq_push(thr_info[work_thr_id].q, wc))) {
-		applog(LOG_ERR, "Failed to tq_push in queue_request");
-		workio_cmd_free(wc);
-		return false;
-	}
+	/* send work request to get_work_thread */
+	if (unlikely(pthread_create(&get_thread, NULL, get_work_thread, (void *)wc)))
+		quit(1, "Failed to create get_work_thread in queue_request");
 
 	return true;
 }