|
|
@@ -237,7 +237,6 @@ bool opt_bfl_noncerange;
|
|
|
struct thr_info *control_thr;
|
|
|
struct thr_info **mining_thr;
|
|
|
static int gwsched_thr_id;
|
|
|
-static int stage_thr_id;
|
|
|
static int watchpool_thr_id;
|
|
|
static int watchdog_thr_id;
|
|
|
#ifdef HAVE_CURSES
|
|
|
@@ -4540,11 +4539,7 @@ static void __kill_work(void)
|
|
|
cgpu->status = LIFE_DEAD2;
|
|
|
}
|
|
|
|
|
|
- applog(LOG_DEBUG, "Killing off stage thread");
|
|
|
/* Stop the others */
|
|
|
- thr = &control_thr[stage_thr_id];
|
|
|
- thr_info_cancel(thr);
|
|
|
-
|
|
|
applog(LOG_DEBUG, "Killing off API thread");
|
|
|
thr = &control_thr[api_thr_id];
|
|
|
thr_info_cancel(thr);
|
|
|
@@ -5910,44 +5905,6 @@ static bool hash_push(struct work *work)
|
|
|
return rc;
|
|
|
}
|
|
|
|
|
|
-static void *stage_thread(void *userdata)
|
|
|
-{
|
|
|
- struct thr_info *mythr = userdata;
|
|
|
- bool ok = true;
|
|
|
-
|
|
|
-#ifndef HAVE_PTHREAD_CANCEL
|
|
|
- pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
|
|
-#endif
|
|
|
-
|
|
|
- RenameThread("stage");
|
|
|
-
|
|
|
- while (ok) {
|
|
|
- struct work *work = NULL;
|
|
|
-
|
|
|
- applog(LOG_DEBUG, "Popping work to stage thread");
|
|
|
-
|
|
|
- work = tq_pop(mythr->q, NULL);
|
|
|
- if (unlikely(!work)) {
|
|
|
- applog(LOG_ERR, "Failed to tq_pop in stage_thread");
|
|
|
- ok = false;
|
|
|
- break;
|
|
|
- }
|
|
|
- work->work_restart_id = work->pool->work_restart_id;
|
|
|
-
|
|
|
- test_work_current(work);
|
|
|
-
|
|
|
- applog(LOG_DEBUG, "Pushing work to getwork queue");
|
|
|
-
|
|
|
- if (unlikely(!hash_push(work))) {
|
|
|
- applog(LOG_WARNING, "Failed to hash_push in stage_thread");
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- tq_freeze(mythr->q);
|
|
|
- return NULL;
|
|
|
-}
|
|
|
-
|
|
|
static void stage_work(struct work *work)
|
|
|
{
|
|
|
applog(LOG_DEBUG, "Pushing work from pool %d to hash queue", work->pool->pool_no);
|
|
|
@@ -8117,7 +8074,7 @@ retry_stratum:
|
|
|
|
|
|
applog(LOG_DEBUG, "Pushing pooltest work to base pool");
|
|
|
|
|
|
- tq_push(control_thr[stage_thr_id].q, work);
|
|
|
+ stage_work(work);
|
|
|
total_getworks++;
|
|
|
pool->getwork_requested++;
|
|
|
ret = true;
|
|
|
@@ -10822,22 +10779,12 @@ int main(int argc, char *argv[])
|
|
|
quit(1, "Failed to calloc mining_thr[%d]", i);
|
|
|
}
|
|
|
|
|
|
- total_control_threads = 7;
|
|
|
+ total_control_threads = 6;
|
|
|
control_thr = calloc(total_control_threads, sizeof(*thr));
|
|
|
if (!control_thr)
|
|
|
quit(1, "Failed to calloc control_thr");
|
|
|
|
|
|
gwsched_thr_id = 0;
|
|
|
- stage_thr_id = 1;
|
|
|
- thr = &control_thr[stage_thr_id];
|
|
|
- thr->q = tq_new();
|
|
|
- if (!thr->q)
|
|
|
- quit(1, "Failed to tq_new");
|
|
|
- /* start stage thread */
|
|
|
- if (thr_info_create(thr, NULL, stage_thread, thr))
|
|
|
- quit(1, "stage thread create failed");
|
|
|
- pthread_detach(thr->pth);
|
|
|
-
|
|
|
/* Create a unique get work queue */
|
|
|
getq = tq_new();
|
|
|
if (!getq)
|
|
|
@@ -10956,14 +10903,14 @@ begin_bench:
|
|
|
quit(1, "submit_work thread create failed");
|
|
|
}
|
|
|
|
|
|
- watchpool_thr_id = 2;
|
|
|
+ watchpool_thr_id = 1;
|
|
|
thr = &control_thr[watchpool_thr_id];
|
|
|
/* start watchpool thread */
|
|
|
if (thr_info_create(thr, NULL, watchpool_thread, NULL))
|
|
|
quit(1, "watchpool thread create failed");
|
|
|
pthread_detach(thr->pth);
|
|
|
|
|
|
- watchdog_thr_id = 3;
|
|
|
+ watchdog_thr_id = 2;
|
|
|
thr = &control_thr[watchdog_thr_id];
|
|
|
/* start watchdog thread */
|
|
|
if (thr_info_create(thr, NULL, watchdog_thread, NULL))
|
|
|
@@ -10972,7 +10919,7 @@ begin_bench:
|
|
|
|
|
|
#ifdef HAVE_OPENCL
|
|
|
/* Create reinit gpu thread */
|
|
|
- gpur_thr_id = 4;
|
|
|
+ gpur_thr_id = 3;
|
|
|
thr = &control_thr[gpur_thr_id];
|
|
|
thr->q = tq_new();
|
|
|
if (!thr->q)
|
|
|
@@ -10982,7 +10929,7 @@ begin_bench:
|
|
|
#endif
|
|
|
|
|
|
/* Create API socket thread */
|
|
|
- api_thr_id = 5;
|
|
|
+ api_thr_id = 4;
|
|
|
thr = &control_thr[api_thr_id];
|
|
|
if (thr_info_create(thr, NULL, api_thread, thr))
|
|
|
quit(1, "API thread create failed");
|
|
|
@@ -11001,7 +10948,7 @@ begin_bench:
|
|
|
/* Create curses input thread for keyboard input. Create this last so
|
|
|
* that we know all threads are created since this can call kill_work
|
|
|
* to try and shut down ll previous threads. */
|
|
|
- input_thr_id = 6;
|
|
|
+ input_thr_id = 5;
|
|
|
thr = &control_thr[input_thr_id];
|
|
|
if (thr_info_create(thr, NULL, input_thread, thr))
|
|
|
quit(1, "input thread create failed");
|
|
|
@@ -11009,7 +10956,7 @@ begin_bench:
|
|
|
#endif
|
|
|
|
|
|
/* Just to be sure */
|
|
|
- if (total_control_threads != 7)
|
|
|
+ if (total_control_threads != 6)
|
|
|
quit(1, "incorrect total_control_threads (%d) should be 7", total_control_threads);
|
|
|
|
|
|
/* Once everything is set up, main() becomes the getwork scheduler */
|