aboutsummaryrefslogtreecommitdiffstats
path: root/os/kernel/include/chregistry.h
diff options
context:
space:
mode:
Diffstat (limited to 'os/kernel/include/chregistry.h')
-rw-r--r--os/kernel/include/chregistry.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/os/kernel/include/chregistry.h b/os/kernel/include/chregistry.h
index 3e9cc5508..0967f699e 100644
--- a/os/kernel/include/chregistry.h
+++ b/os/kernel/include/chregistry.h
@@ -30,6 +30,34 @@
#define _CHREGISTRY_H_
#if CH_USE_REGISTRY || defined(__DOXYGEN__)
+/**
+ * @brief Sets the current thread name.
+ * @pre This function only stores the pointer to the name if the option
+ * @p CH_USE_REGISTRY is enabled else no action is performed.
+ *
+ * @param[in] p thread name as a zero terminated string
+ *
+ * @api
+ */
+#define chRegSetThreadName(p) (currp->p_name = (p))
+
+/**
+ * @brief Returns the name of the specified thread.
+ * @pre This function only returns the pointer to the name if the option
+ * @p CH_USE_REGISTRY is enabled else @p NULL is returned.
+ *
+ * @param[in] tp pointer to the thread
+ *
+ * @return Thread name as a zero terminated string.
+ * @retval NULL if the thread name has not been set.
+ */
+#define chRegGetThreadName(tp) ((tp)->p_name)
+#else /* !CH_USE_REGISTRY */
+#define chRegSetThreadName(p)
+#define chRegGetThreadName(tp) NULL
+#endif /* !CH_USE_REGISTRY */
+
+#if CH_USE_REGISTRY || defined(__DOXYGEN__)
/**
* @brief Removes a thread from the registry list.