From 26d1eb38e6dd68017567827243a26aab37551de7 Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Tue, 12 Sep 2017 11:47:18 -0700 Subject: [PATCH] stack_sentinel: remove check in _new_thread We already check the stack sentinel for outgoing thread when we _Swap, just leverage that. The thread state check in _check_stack_sentinel now only exits if the current thread is a dummy thread. Signed-off-by: Andrew Boie --- kernel/thread.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/kernel/thread.c b/kernel/thread.c index ade69e1dbc7..cfdb2373cb6 100644 --- a/kernel/thread.c +++ b/kernel/thread.c @@ -143,7 +143,6 @@ void _thread_monitor_exit(struct k_thread *thread) * 1) In k_yield() if the current thread is not swapped out * 2) After servicing a non-nested interrupt * 3) In _Swap(), check the sentinel in the outgoing thread - * 4) When a thread returns from its entry function to cooperatively terminate * * Item 2 requires support in arch/ code. * @@ -154,10 +153,7 @@ void _check_stack_sentinel(void) { u32_t *stack; - if (_is_thread_prevented_from_running(_current)) { - /* Filter out threads that are dummy threads or already - * marked for termination (_THREAD_DEAD) - */ + if (_current->base.thread_state == _THREAD_DUMMY) { return; } @@ -185,9 +181,6 @@ FUNC_NORETURN void _thread_entry(k_thread_entry_t entry, { entry(p1, p2, p3); -#ifdef CONFIG_STACK_SENTINEL - _check_stack_sentinel(); -#endif #ifdef CONFIG_MULTITHREADING k_thread_abort(k_current_get()); #else