aboutsummaryrefslogtreecommitdiffstats
path: root/os/rt/include/chsys.h
diff options
context:
space:
mode:
Diffstat (limited to 'os/rt/include/chsys.h')
-rw-r--r--os/rt/include/chsys.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/os/rt/include/chsys.h b/os/rt/include/chsys.h
index 4371feb87..936b0fea5 100644
--- a/os/rt/include/chsys.h
+++ b/os/rt/include/chsys.h
@@ -387,6 +387,25 @@ static inline void chSysUnconditionalUnlock(void) {
chSysUnlock();
}
+#if !CH_CFG_NO_IDLE_THREAD || defined(__DOXYGEN__)
+/**
+ * @brief Returns a pointer to the idle thread.
+ * @pre In order to use this function the option @p CH_CFG_NO_IDLE_THREAD
+ * must be disabled.
+ * @note The reference counter of the idle thread is not incremented but
+ * it is not strictly required being the idle thread a static
+ * object.
+ *
+ * @return Pointer to the idle thread.
+ *
+ * @xclass
+ */
+static inline thread_t *chSysGetIdleThreadX(void) {
+
+ return ch.rlist.r_queue.p_prev;
+}
+#endif /* !CH_CFG_NO_IDLE_THREAD */
+
#endif /* _CHSYS_H_ */
/** @} */