kernel: refactor thread_monitor_init into common code

We do the same thing on all arch's right now for thread_monitor_init so
lets put it in a common place.  This also should fix an issue on xtensa
when thread monitor can be enabled (reference to _nanokernel.threads).

Change-Id: If2f26c1578aa1f18565a530de4880ae7bd5a0da2
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2017-04-21 11:33:57 -05:00 committed by Andrew Boie
commit 96ee45df8d
7 changed files with 20 additions and 131 deletions

View file

@ -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_ */