From 4c746c721ed4fadc15964b725707faf753843a9d Mon Sep 17 00:00:00 2001
From: Dmitry Kozlov <xeb@mail.ru>
Date: Wed, 27 Dec 2017 11:43:09 +0300
Subject: triton: fixed bugs introduced by previous commit

---
 accel-pppd/triton/triton.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/accel-pppd/triton/triton.c b/accel-pppd/triton/triton.c
index 785d18f3..64ca7b8f 100644
--- a/accel-pppd/triton/triton.c
+++ b/accel-pppd/triton/triton.c
@@ -133,7 +133,7 @@ static void* triton_thread(struct _triton_thread_t *thread)
 				if (this_ctx->before_switch)
 					this_ctx->before_switch(this_ctx, thread->ctx->bf_arg);
 
-				//alloca(thread->ctx->uc->uc_stack.ss_size);
+				alloca(thread->ctx->uc->uc_stack.ss_size + 64);
 				memcpy(thread_frame - thread->ctx->uc->uc_stack.ss_size, thread->ctx->uc->uc_stack.ss_sp, thread->ctx->uc->uc_stack.ss_size);
 				setcontext(thread->ctx->uc);
 				abort();
@@ -328,12 +328,12 @@ int triton_queue_ctx(struct _triton_context_t *ctx)
 {
 	spin_lock(&threads_lock);
 	ctx->pending = 1;
-	if (ctx->thread || ctx->queued || ctx->init || ctx->need_free) {
+	if (ctx->thread || ctx->entry2.next || ctx->need_free) {
 		spin_unlock(&threads_lock);
 		return 0;
 	}
 
-	if (list_empty(&sleep_threads) || need_config_reload) {
+	if (list_empty(&sleep_threads) || ctx->init || need_config_reload) {
 		list_add_tail(&ctx->entry2, &ctx_queue[ctx->priority]);
 		spin_unlock(&threads_lock);
 		ctx->queued = 1;
-- 
cgit v1.2.3