git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3362 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
gdisirio 2011-09-20 17:08:22 +00:00
parent bd339dfa99
commit 5463b41d3a
4 changed files with 28 additions and 2 deletions

View File

@ -345,6 +345,7 @@ extern "C" {
void chThdSleepUntil(systime_t time);
void chThdYield(void);
void chThdExit(msg_t msg);
void chThdExitS(msg_t msg);
#if CH_USE_WAITEXIT
msg_t chThdWait(Thread *tp);
#endif

View File

@ -335,6 +335,27 @@ void chThdYield(void) {
* @api
*/
void chThdExit(msg_t msg) {
chSysLock();
chThdExitS(msg);
/* The thread never returns here.*/
}
/**
* @brief Terminates the current thread.
* @details The thread goes in the @p THD_STATE_FINAL state holding the
* specified exit status code, other threads can retrieve the
* exit status code by invoking the function @p chThdWait().
* @post Eventual code after this function will never be executed,
* this function never returns. The compiler has no way to
* know this so do not assume that the compiler would remove
* the dead code.
*
* @param[in] msg thread exit code
*
* @sclass
*/
void chThdExitS(msg_t msg) {
Thread *tp = currp;
chSysLock();
@ -353,7 +374,8 @@ void chThdExit(msg_t msg) {
REG_REMOVE(tp);
#endif
chSchGoSleepS(THD_STATE_FINAL);
chSysUnlock();
/* The thread never returns here.*/
chDbgAssert(FALSE, "chThdExitS(), #1", "zombies apocalypse");
}
#if CH_USE_WAITEXIT || defined(__DOXYGEN__)

View File

@ -204,9 +204,10 @@ static msg_t shell_thread(void *p) {
}
}
}
/* Atomically broadcasting the event source and terminating the thread,
there is not a chSysUnlock() because the thread terminates upon return.*/
chSysLock();
chEvtBroadcastI(&shell_terminated);
chSysUnlock();
return msg;
}

View File

@ -73,6 +73,8 @@
*****************************************************************************
*** 2.3.3 ***
- FIX: The function chThdExit() triggers an error on shell return when the
system state checker is enabled (bug 3411207)(backported to 2.2.8).
- FIX: Some ARMCMx makefiles refer the file rules.mk in the ARM7 port (bug
3411180)(backported to 2.2.8).
- FIX: Fixed wrong check on CH_DBG_ENABLE_STACK_CHECK setting (bug 3387671)