From bb43859b0946c7b8cc75e8400e6cdb658ade8707 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Sat, 28 Oct 2006 13:42:30 +0000 Subject: [PATCH] Do not free semaphore if there are waiters --- lib/silcutil/silcfsm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/silcutil/silcfsm.c b/lib/silcutil/silcfsm.c index c94425d0..f2fb362d 100644 --- a/lib/silcutil/silcfsm.c +++ b/lib/silcutil/silcfsm.c @@ -371,9 +371,9 @@ SILC_TASK_CALLBACK(silc_fsm_run) /* If we are thread and using real threads, the FSM thread will finish in the main thread, not in the created 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); - silc_schedule_stop(fsm->schedule); break; } @@ -466,9 +466,8 @@ void silc_fsm_sema_free(SilcFSMSema sema) { if (sema->refcnt > 0) return; -#if defined(SILC_DEBUG) - assert(silc_list_count(sema->waiters) == 0); -#endif /* SILC_DEBUG */ + if (silc_list_count(sema->waiters) > 0) + return; silc_free(sema); } -- 2.24.0