From 2d7bbbe3b7e3ca0b7e34e6909c390c98e5bce8e6 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Thu, 2 Nov 2006 08:07:57 +0000 Subject: [PATCH] =?utf8?q?=09Finish=20real=20thread=20FSM=20after=20thread?= =?utf8?q?=20scheduler=20has=20finished.=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lib/silcutil/silcfsm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/silcutil/silcfsm.c b/lib/silcutil/silcfsm.c index 2c95ccd1..caab3380 100644 --- a/lib/silcutil/silcfsm.c +++ b/lib/silcutil/silcfsm.c @@ -369,11 +369,9 @@ SILC_TASK_CALLBACK(silc_fsm_run) fsm->finished = TRUE; /* If we are thread and using real threads, the FSM thread will finish - in the main thread, not in the created thread. */ + after the real thread has finished, in the main thread. */ if (fsm->thread && fsm->real_thread) { silc_schedule_stop(fsm->schedule); - silc_schedule_task_add_timeout(app_context, silc_fsm_finish, fsm, 0, 1); - silc_schedule_wakeup(app_context); break; } @@ -698,5 +696,10 @@ static void *silc_fsm_thread(void *context) fsm->schedule = old; + /* Finish the FSM thread in the main thread */ + SILC_ASSERT(fsm->finished); + silc_schedule_task_add_timeout(fsm->schedule, silc_fsm_finish, fsm, 0, 1); + silc_schedule_wakeup(fsm->schedule); + return NULL; } -- 2.43.0