diff --git a/arch/arc/core/thread.c b/arch/arc/core/thread.c index 3b14a03fbeb..0fec255a413 100644 --- a/arch/arc/core/thread.c +++ b/arch/arc/core/thread.c @@ -29,25 +29,6 @@ struct init_stack_frame { u32_t r0; }; -#if defined(CONFIG_THREAD_MONITOR) -/* - * Add a thread to the kernel's list of active threads. - */ -static ALWAYS_INLINE void thread_monitor_init(struct k_thread *thread) -{ - unsigned int key; - - key = irq_lock(); - thread->next_thread = _kernel.threads; - _kernel.threads = thread; - irq_unlock(key); -} -#else -#define thread_monitor_init(thread) \ - do {/* do nothing */ \ - } while ((0)) -#endif /* CONFIG_THREAD_MONITOR */ - /* * @brief Initialize a new thread from its stack space * diff --git a/arch/arm/core/thread.c b/arch/arm/core/thread.c index afe93719248..0e9f6f6568d 100644 --- a/arch/arm/core/thread.c +++ b/arch/arm/core/thread.c @@ -19,25 +19,6 @@ #include #endif /* CONFIG_INIT_STACKS */ -#if defined(CONFIG_THREAD_MONITOR) -/* - * Add a thread to the kernel's list of active threads. - */ -static ALWAYS_INLINE void thread_monitor_init(struct k_thread *thread) -{ - unsigned int key; - - key = irq_lock(); - thread->next_thread = _kernel.threads; - _kernel.threads = thread; - irq_unlock(key); -} -#else -#define thread_monitor_init(thread) \ - do {/* do nothing */ \ - } while ((0)) -#endif /* CONFIG_THREAD_MONITOR */ - /** * * @brief Initialize a new thread from its stack space diff --git a/arch/nios2/core/thread.c b/arch/nios2/core/thread.c index 941cb1dccff..c7ceead93c8 100644 --- a/arch/nios2/core/thread.c +++ b/arch/nios2/core/thread.c @@ -10,25 +10,6 @@ #include #include -#if defined(CONFIG_THREAD_MONITOR) -/* - * Add a thread to the kernel's list of active threads. - */ -static ALWAYS_INLINE void thread_monitor_init(struct k_thread *thread) -{ - unsigned int key; - - key = irq_lock(); - thread->next_thread = _kernel.threads; - _kernel.threads = thread; - irq_unlock(key); -} -#else -#define thread_monitor_init(thread) \ - do {/* do nothing */ \ - } while ((0)) -#endif /* CONFIG_THREAD_MONITOR */ - /* forward declaration to asm function to adjust setup the arguments * to _thread_entry() since this arch puts the first four arguments * in r4-r7 and not on the stack diff --git a/arch/riscv32/core/thread.c b/arch/riscv32/core/thread.c index 435e222331a..557573f8530 100644 --- a/arch/riscv32/core/thread.c +++ b/arch/riscv32/core/thread.c @@ -10,25 +10,6 @@ #include #include -#if defined(CONFIG_THREAD_MONITOR) -/* - * Add a thread to the kernel's list of active threads. - */ -static ALWAYS_INLINE void thread_monitor_init(struct k_thread *thread) -{ - unsigned int key; - - key = irq_lock(); - thread->next_thread = _kernel.threads; - _kernel.threads = thread; - irq_unlock(key); -} -#else -#define thread_monitor_init(thread) \ - do {/* do nothing */ \ - } while ((0)) -#endif /* CONFIG_THREAD_MONITOR */ - void _thread_entry_wrapper(_thread_entry_t thread, void *arg1, void *arg2, diff --git a/arch/x86/core/thread.c b/arch/x86/core/thread.c index d9d948a05c6..267085ab417 100644 --- a/arch/x86/core/thread.c +++ b/arch/x86/core/thread.c @@ -29,25 +29,6 @@ void _thread_entry_wrapper(_thread_entry_t, void *, void *, void *); #endif -#if defined(CONFIG_THREAD_MONITOR) -/* - * Add a thread to the kernel's list of active threads. - */ -static ALWAYS_INLINE void thread_monitor_init(struct k_thread *thread) -{ - unsigned int key; - - key = irq_lock(); - thread->next_thread = _kernel.threads; - _kernel.threads = thread; - irq_unlock(key); -} -#else -#define thread_monitor_init(thread) \ - do {/* do nothing */ \ - } while ((0)) -#endif /* CONFIG_THREAD_MONITOR */ - /** * * @brief Initialize a new execution thread diff --git a/arch/xtensa/core/thread.c b/arch/xtensa/core/thread.c index 874ca39bf08..7af19dfe9ba 100644 --- a/arch/xtensa/core/thread.c +++ b/arch/xtensa/core/thread.c @@ -15,41 +15,6 @@ extern void _xt_user_exit(void); -#if defined(CONFIG_THREAD_MONITOR) -#define THREAD_MONITOR_INIT(thread) _thread_monitor_init(thread) -#else -#define THREAD_MONITOR_INIT(thread) \ - do {/* do nothing */ \ - } while ((0)) -#endif - -#if defined(CONFIG_THREAD_MONITOR) -/** - * - * @brief Initialize thread monitoring support - * - * Currently only inserts the new thread in the list of active threads. - * - * @return N/A - */ - -static inline void _thread_monitor_init(struct k_thread *thread) -{ - unsigned int key; - - /* - * Add the newly initialized thread to head of the list of threads. - * This singly linked list of threads maintains ALL the threads in the - * system regardless of whether they are runnable. - */ - - key = irq_lock(); - thread->next_thread = _nanokernel.threads; - _nanokernel.threads = thread; - irq_unlock(key); -} -#endif /* CONFIG_THREAD_MONITOR */ - /* * @brief Initialize a new thread from its stack space * @@ -164,6 +129,6 @@ void _new_thread(char *pStack, size_t stackSize, * irrelevant */ - THREAD_MONITOR_INIT(thread); + thread_monitor_init(thread); } diff --git a/kernel/include/kernel_structs.h b/kernel/include/kernel_structs.h index 752d0720204..02bfc4526be 100644 --- a/kernel/include/kernel_structs.h +++ b/kernel/include/kernel_structs.h @@ -268,6 +268,25 @@ static ALWAYS_INLINE struct k_thread *_new_thread_init(char *pStack, return thread; } +#if defined(CONFIG_THREAD_MONITOR) +/* + * Add a thread to the kernel's list of active threads. + */ +static ALWAYS_INLINE void thread_monitor_init(struct k_thread *thread) +{ + unsigned int key; + + key = irq_lock(); + thread->next_thread = _kernel.threads; + _kernel.threads = thread; + irq_unlock(key); +} +#else +#define thread_monitor_init(thread) \ + do {/* do nothing */ \ + } while ((0)) +#endif /* CONFIG_THREAD_MONITOR */ + #endif /* _ASMLANGUAGE */ #endif /* _kernel_structs__h_ */