Submit work async is still unreliable and only used for cpu mining, so back it out for now.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
diff --git a/cpu-miner.c b/cpu-miner.c
index 4dd361b..6db4043 100644
--- a/cpu-miner.c
+++ b/cpu-miner.c
@@ -643,68 +643,6 @@ out:
return ret;
}
-struct submit_data {
- struct thr_info *thr;
- struct work *work_in;
- pthread_t pth;
-};
-
-static void *submit_work(void *userdata)
-{
- struct submit_data *sd = (struct submit_data *)userdata;
- struct workio_cmd *wc;
-
- /* fill out work request message */
- wc = calloc(1, sizeof(*wc));
- if (unlikely(!wc))
- goto out;
-
- wc->u.work = malloc(sizeof(struct work));
- if (unlikely(!wc->u.work))
- goto err_out;
-
- wc->cmd = WC_SUBMIT_WORK;
- wc->thr = sd->thr;
- memcpy(wc->u.work, &sd->work_in, sizeof(struct work));
-
- /* send solution to workio thread */
- if (unlikely(!tq_push(thr_info[work_thr_id].q, wc)))
- goto err_out;
-
- goto out;
-
-err_out:
- workio_cmd_free(wc);
-out:
- pthread_detach(pthread_self());
- free(sd);
- return NULL;
-}
-
-static bool submit_work_async(struct thr_info *thr, const struct work *work_in)
-{
- struct submit_data *sd = malloc(sizeof(struct submit_data));
- if (unlikely(!sd)) {
- applog(LOG_ERR, "Failed to malloc sd in submit_work_async");
- return false;
- }
- sd->work_in = malloc(sizeof(struct work));
- if (unlikely(!sd->work_in)) {
- applog(LOG_ERR, "Failed to malloc work_in in submit_work_async");
- return false;
- }
-
- memcpy(sd->work_in, work_in, sizeof(struct work));
- /* Pass the thread id to the work struct for per-thread accounting */
- sd->work_in->thr_id = thr->id;
-
- if (pthread_create(&sd->pth, NULL, submit_work, (void *)sd)) {
- applog(LOG_ERR, "Failed to create submit_thread");
- return false;
- }
- return true;
-}
-
static bool submit_work_sync(struct thr_info *thr, const struct work *work_in)
{
struct workio_cmd *wc;
@@ -865,7 +803,7 @@ static void *miner_thread(void *userdata)
if (unlikely(rc)) {
if (opt_debug)
applog(LOG_DEBUG, "CPU %d found something?", cpu_from_thr_id(thr_id));
- if (!submit_work_async(mythr, &work))
+ if (!submit_work_sync(mythr, &work))
break;
}
}