aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2016-03-09 16:06:50 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2016-03-09 16:06:50 +0000
commit0a24a2e42658ec42b7f0217b5e5022877bd0ea0a (patch)
treee6682bcfc3f3e154020f30ac777fd4401a282efa /os
parent0d4df3cf1b03cf19b24cbacf7bd5908d9968beab (diff)
downloadChibiOS-0a24a2e42658ec42b7f0217b5e5022877bd0ea0a.tar.gz
ChibiOS-0a24a2e42658ec42b7f0217b5e5022877bd0ea0a.tar.bz2
ChibiOS-0a24a2e42658ec42b7f0217b5e5022877bd0ea0a.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9059 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/common/abstractions/nasa_osal/include/osapi-os-custom.h1
-rw-r--r--os/common/abstractions/nasa_osal/src/osapi.c22
2 files changed, 23 insertions, 0 deletions
diff --git a/os/common/abstractions/nasa_osal/include/osapi-os-custom.h b/os/common/abstractions/nasa_osal/include/osapi-os-custom.h
index dffe97c6d..34b63322e 100644
--- a/os/common/abstractions/nasa_osal/include/osapi-os-custom.h
+++ b/os/common/abstractions/nasa_osal/include/osapi-os-custom.h
@@ -54,6 +54,7 @@ extern "C" {
#endif
void OS_set_printf(int (*printf)(const char *fmt, ...));
boolean OS_TaskDeleteCheck(void);
+ int32 OS_TaskWait(uint32 task_id);
#ifdef __cplusplus
}
#endif
diff --git a/os/common/abstractions/nasa_osal/src/osapi.c b/os/common/abstractions/nasa_osal/src/osapi.c
index 685c936b6..4dc39969d 100644
--- a/os/common/abstractions/nasa_osal/src/osapi.c
+++ b/os/common/abstractions/nasa_osal/src/osapi.c
@@ -1912,6 +1912,28 @@ void OS_TaskExit(void) {
}
/**
+ * @brief Wait for task termination.
+ * @note This is a ChibiOS/RT extension, added for improved testability.
+ *
+ * @param[in] task_id the task id
+ * @return An error code.
+ *
+ * @api
+ */
+int32 OS_TaskWait(uint32 task_id) {
+ thread_t *tp = (thread_t *)task_id;
+
+ /* Check for thread validity, getting a reference.*/
+ if (chRegFindThreadByPointer(tp) == NULL) {
+ return OS_ERR_INVALID_ID;
+ }
+
+ (void) chThdWait(tp);
+
+ return OS_SUCCESS;
+}
+
+/**
* @brief Task delay.
*
* @param[in] milli_second the period in miliseconds