aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-09-18 08:31:12 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-09-18 08:31:12 +0000
commit6c3bddd257cc521db0d5bf5fb9524fdd234e038e (patch)
treecdd00904f04a90770def33be4e3f4b3cca184098 /os
parent9ffea7e261ec4016d788abbbf7c4a6d3a78e0a04 (diff)
downloadChibiOS-6c3bddd257cc521db0d5bf5fb9524fdd234e038e.tar.gz
ChibiOS-6c3bddd257cc521db0d5bf5fb9524fdd234e038e.tar.bz2
ChibiOS-6c3bddd257cc521db0d5bf5fb9524fdd234e038e.zip
Fixed bug 3069854, fixed documentation article about events.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2180 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/kernel/src/chthreads.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/os/kernel/src/chthreads.c b/os/kernel/src/chthreads.c
index 33ba3741e..5bcadb96d 100644
--- a/os/kernel/src/chthreads.c
+++ b/os/kernel/src/chthreads.c
@@ -67,14 +67,15 @@
*/
Thread *init_thread(Thread *tp, tprio_t prio) {
- tp->p_flags = THD_MEM_MODE_STATIC;
tp->p_prio = prio;
tp->p_state = THD_STATE_SUSPENDED;
-#if CH_USE_REGISTRY
- REG_INSERT(tp);
+ tp->p_flags = THD_MEM_MODE_STATIC;
+#if CH_USE_MUTEXES
+ tp->p_realprio = prio;
+ tp->p_mtxlist = NULL;
#endif
-#if CH_USE_DYNAMIC
- tp->p_refs = 1;
+#if CH_USE_EVENTS
+ tp->p_epending = 0;
#endif
#if CH_USE_NESTED_LOCKS
tp->p_locks = 0;
@@ -82,9 +83,8 @@ Thread *init_thread(Thread *tp, tprio_t prio) {
#if CH_DBG_THREADS_PROFILING
tp->p_time = 0;
#endif
-#if CH_USE_MUTEXES
- tp->p_realprio = prio;
- tp->p_mtxlist = NULL;
+#if CH_USE_DYNAMIC
+ tp->p_refs = 1;
#endif
#if CH_USE_WAITEXIT
list_init(&tp->p_waiting);
@@ -92,8 +92,10 @@ Thread *init_thread(Thread *tp, tprio_t prio) {
#if CH_USE_MESSAGES
queue_init(&tp->p_msgqueue);
#endif
-#if CH_USE_EVENTS
- tp->p_epending = 0;
+#if CH_USE_REGISTRY
+ chSysLock();
+ REG_INSERT(tp);
+ chSysUnlock();
#endif
#if defined(THREAD_EXT_EXIT_HOOK)
THREAD_EXT_INIT_HOOK(tp);
@@ -117,9 +119,6 @@ static void memfill(uint8_t *startp, uint8_t *endp, uint8_t v) {
* @p chThdResume().
* @note A thread can terminate by calling @p chThdExit() or by simply
* returning from its main function.
- * @note This function can be invoked from within an interrupt handler
- * even if it is not an I-Class API because it does not touch
- * any critical kernel data structure.
*
* @param[out] wsp pointer to a working area dedicated to the thread stack
* @param[in] size size of the working area
@@ -461,6 +460,8 @@ void chThdRelease(Thread *tp) {
* Please read the @ref article_lifecycle article for more details.
* @pre The configuration option @p CH_USE_WAITEXIT must be enabled in
* order to use this function.
+ * @post Enabling @p chThdWait() requires 2-4 (depending on the
+ * architecture) extra bytes in the @p Thread structure.
* @post After invoking @p chThdWait() the thread pointer becomes invalid
* and must not be used as parameter for further system calls.
* @note If @p CH_USE_DYNAMIC is not specified this function just waits for