From: Pekka Riikonen Date: Sat, 28 Oct 2006 13:42:30 +0000 (+0000) Subject: Do not free semaphore if there are waiters X-Git-Tag: silc.client.1.1.beta1~228 X-Git-Url: http://git.silcnet.org/gitweb/?a=commitdiff_plain;h=bb43859b0946c7b8cc75e8400e6cdb658ade8707;p=silc.git Do not free semaphore if there are waiters --- 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); }