From: Pekka Riikonen Date: Fri, 8 Jun 2007 15:44:41 +0000 (+0000) Subject: Check for existing threads in the FSM machine finishing in the X-Git-Tag: 1.2.beta4~12^2~143 X-Git-Url: http://git.silcnet.org/gitweb/?a=commitdiff_plain;h=7b7aeef04e5dad0576103a09f9ef699178498af5;p=runtime.git Check for existing threads in the FSM machine finishing in the final free callback to give time for threads to finish. --- diff --git a/lib/silcutil/silcfsm.c b/lib/silcutil/silcfsm.c index f22540cd..3382713e 100644 --- a/lib/silcutil/silcfsm.c +++ b/lib/silcutil/silcfsm.c @@ -317,10 +317,6 @@ void silc_fsm_finish(void *fsm) SILC_ASSERT(!f->finished); - /* Machine must not have active threads */ - if (!f->thread && silc_atomic_get_int32(&f->u.m.threads)) - assert(silc_atomic_get_int32(&f->u.m.threads) == 0); - f->started = FALSE; f->finished = TRUE; @@ -484,6 +480,9 @@ SILC_TASK_CALLBACK(silc_fsm_finish_fsm) fsm->destructor(fsm, fsm->fsm_context, fsm->destructor_context); } else { + /* Machine must not have active threads */ + assert(silc_atomic_get_int32(&fsm->u.m.threads) == 0); + if (fsm->u.m.lock) { silc_mutex_free(fsm->u.m.lock); fsm->u.m.lock = NULL;