From 8feba91865981a1cb8b1ba12c4bce09997141f2f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 26 Sep 2008 10:46:10 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@444 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- src/chthreads.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/chthreads.c') diff --git a/src/chthreads.c b/src/chthreads.c index 676df3d68..755cda99e 100644 --- a/src/chthreads.c +++ b/src/chthreads.c @@ -51,9 +51,7 @@ Thread *init_thread(Thread *tp, tprio_t prio) { #ifdef CH_USE_EXIT_EVENT chEvtInit(&tp->p_exitesource); #endif -#ifdef CH_USE_THREAD_EXT THREAD_EXT_INIT(tp); -#endif return tp; } @@ -295,16 +293,17 @@ void chThdTerminate(Thread *tp) { * \p chThdWait(). */ void chThdExit(msg_t msg) { + Thread *tp = currp; chSysLock(); - - currp->p_exitcode = msg; + tp->p_exitcode = msg; + THREAD_EXT_EXIT(tp); #ifdef CH_USE_WAITEXIT - while (notempty(&currp->p_waiting)) - chSchReadyI(list_remove(&currp->p_waiting)); + while (notempty(&tp->p_waiting)) + chSchReadyI(list_remove(&tp->p_waiting)); #endif #ifdef CH_USE_EXIT_EVENT - chEvtBroadcastI(&currp->p_exitesource); + chEvtBroadcastI(&tp->p_exitesource); #endif chSchGoSleepS(PREXIT); } -- cgit v1.2.3