aboutsummaryrefslogtreecommitdiffstats
path: root/src/chthreads.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-09-26 10:46:10 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-09-26 10:46:10 +0000
commit8feba91865981a1cb8b1ba12c4bce09997141f2f (patch)
tree49383b0d56e82f342e74b6fa3ac831b884070150 /src/chthreads.c
parent3d4a6e15ed6b9dc80403288b36d22839de6e2320 (diff)
downloadChibiOS-8feba91865981a1cb8b1ba12c4bce09997141f2f.tar.gz
ChibiOS-8feba91865981a1cb8b1ba12c4bce09997141f2f.tar.bz2
ChibiOS-8feba91865981a1cb8b1ba12c4bce09997141f2f.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@444 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/chthreads.c')
-rw-r--r--src/chthreads.c13
1 files changed, 6 insertions, 7 deletions
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);
}