diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-10-01 09:25:06 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-10-01 12:32:54 +0200 |
commit | e50e3f7087cfe6fab4c3a49398e4bd40fe2a2e33 (patch) | |
tree | 5e0c72fc4cf784525943441ba082e706d0c62b90 /cpukit | |
parent | telnetd: Remove CEXP convenience routines (diff) | |
download | rtems-e50e3f7087cfe6fab4c3a49398e4bd40fe2a2e33.tar.bz2 |
rtems: Add rtems_task_exit()
Update #3533.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/include/rtems/rtems/tasks.h | 2 | ||||
-rw-r--r-- | cpukit/rtems/Makefile.am | 1 | ||||
-rw-r--r-- | cpukit/rtems/src/taskexit.c | 38 |
3 files changed, 41 insertions, 0 deletions
diff --git a/cpukit/include/rtems/rtems/tasks.h b/cpukit/include/rtems/rtems/tasks.h index 585f4c449c..aaba8851df 100644 --- a/cpukit/include/rtems/rtems/tasks.h +++ b/cpukit/include/rtems/rtems/tasks.h @@ -227,6 +227,8 @@ rtems_status_code rtems_task_delete( rtems_id id ); +void rtems_task_exit( void ) RTEMS_NO_RETURN; + /** * @brief RTEMS Task Mode * diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am index 7af4ec7deb..fdef7f8022 100644 --- a/cpukit/rtems/Makefile.am +++ b/cpukit/rtems/Makefile.am @@ -33,6 +33,7 @@ librtems_a_SOURCES += src/rtemsobjectgetclassicname.c librtems_a_SOURCES += src/tasks.c librtems_a_SOURCES += src/taskcreate.c librtems_a_SOURCES += src/taskdelete.c +librtems_a_SOURCES += src/taskexit.c librtems_a_SOURCES += src/taskgetaffinity.c librtems_a_SOURCES += src/taskgetpriority.c librtems_a_SOURCES += src/taskgetscheduler.c diff --git a/cpukit/rtems/src/taskexit.c b/cpukit/rtems/src/taskexit.c new file mode 100644 index 0000000000..7faf8ae108 --- /dev/null +++ b/cpukit/rtems/src/taskexit.c @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2018 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include <rtems/rtems/tasks.h> +#include <rtems/score/threadimpl.h> + +void rtems_task_exit( void ) +{ + Thread_Control *executing; + Per_CPU_Control *cpu_self; + + cpu_self = _Thread_Dispatch_disable(); + executing = _Per_CPU_Get_executing( cpu_self ); + + _Thread_Exit( + executing, + THREAD_LIFE_TERMINATING | THREAD_LIFE_DETACHED, + NULL + ); + + _Thread_Dispatch_direct( cpu_self ); + RTEMS_UNREACHABLE(); +} |