From dca8b7b6bb49ef90467938c4eae4c6fa7924de1f Mon Sep 17 00:00:00 2001 From: Thanassis Tsiodras Date: Tue, 28 Mar 2017 10:22:10 +0200 Subject: [PATCH] Added common termination primitive for the worker tasks Both of the worker tasks must signal their result through the message queue, and then kill themselves - common work refactored in. --- EDISOFT/src/common.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 EDISOFT/src/common.c diff --git a/EDISOFT/src/common.c b/EDISOFT/src/common.c new file mode 100644 index 0000000..b78b9cd --- /dev/null +++ b/EDISOFT/src/common.c @@ -0,0 +1,15 @@ +#include +#include "system.h" + +void die(int task_no, unsigned exitCode) +{ + rtems_status_code status = RTEMS_SUCCESSFUL; + + exitCode = exitCode << 31; + exitCode |= task_no; + status = rtems_message_queue_send(Q_id, &exitCode, 4); + if (status != RTEMS_SUCCESSFUL) { + printk("[TASK %d] Failed to rtems_message_queue_send, status: %d\n", task_no, status); + } + rtems_task_delete(RTEMS_SELF); +} -- GitLab