From: Pekka Riikonen Date: Thu, 2 Nov 2006 08:07:57 +0000 (+0000) Subject: Finish real thread FSM after thread scheduler has finished.§ X-Git-Tag: silc.client.1.1.beta1~222 X-Git-Url: http://git.silcnet.org/gitweb/?a=commitdiff_plain;h=2d7bbbe3b7e3ca0b7e34e6909c390c98e5bce8e6;p=silc.git Finish real thread FSM after thread scheduler has finished.§ --- 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; }