|
|
@@ -831,9 +831,7 @@ void tq_free(struct thread_q *tq)
|
|
|
static void tq_freezethaw(struct thread_q *tq, bool frozen)
|
|
|
{
|
|
|
mutex_lock(&tq->mutex);
|
|
|
-
|
|
|
tq->frozen = frozen;
|
|
|
-
|
|
|
pthread_cond_signal(&tq->cond);
|
|
|
mutex_unlock(&tq->mutex);
|
|
|
}
|
|
|
@@ -861,14 +859,12 @@ bool tq_push(struct thread_q *tq, void *data)
|
|
|
INIT_LIST_HEAD(&ent->q_node);
|
|
|
|
|
|
mutex_lock(&tq->mutex);
|
|
|
-
|
|
|
if (!tq->frozen) {
|
|
|
list_add_tail(&ent->q_node, &tq->q);
|
|
|
} else {
|
|
|
free(ent);
|
|
|
rc = false;
|
|
|
}
|
|
|
-
|
|
|
pthread_cond_signal(&tq->cond);
|
|
|
mutex_unlock(&tq->mutex);
|
|
|
|
|
|
@@ -882,7 +878,6 @@ void *tq_pop(struct thread_q *tq, const struct timespec *abstime)
|
|
|
int rc;
|
|
|
|
|
|
mutex_lock(&tq->mutex);
|
|
|
-
|
|
|
if (!list_empty(&tq->q))
|
|
|
goto pop;
|
|
|
|
|
|
@@ -894,16 +889,15 @@ void *tq_pop(struct thread_q *tq, const struct timespec *abstime)
|
|
|
goto out;
|
|
|
if (list_empty(&tq->q))
|
|
|
goto out;
|
|
|
-
|
|
|
pop:
|
|
|
ent = list_entry(tq->q.next, struct tq_ent, q_node);
|
|
|
rval = ent->data;
|
|
|
|
|
|
list_del(&ent->q_node);
|
|
|
free(ent);
|
|
|
-
|
|
|
out:
|
|
|
mutex_unlock(&tq->mutex);
|
|
|
+
|
|
|
return rval;
|
|
|
}
|
|
|
|
|
|
@@ -1798,6 +1792,7 @@ static bool setup_stratum_curl(struct pool *pool)
|
|
|
if (pool->sockbuf)
|
|
|
pool->sockbuf[0] = '\0';
|
|
|
mutex_unlock(&pool->stratum_lock);
|
|
|
+
|
|
|
curl = pool->stratum_curl;
|
|
|
|
|
|
if (!pool->sockbuf) {
|
|
|
@@ -1889,6 +1884,7 @@ void suspend_stratum(struct pool *pool)
|
|
|
{
|
|
|
clear_sockbuf(pool);
|
|
|
applog(LOG_INFO, "Closing socket for stratum pool %d", pool->pool_no);
|
|
|
+
|
|
|
mutex_lock(&pool->stratum_lock);
|
|
|
pool->stratum_active = pool->stratum_notify = false;
|
|
|
if (pool->stratum_curl) {
|