kernel: Standardize thread monitoring initialization

Gets rid of unnecessary THREAD_MONITOR_INIT() macro, to be
consistent with the approach taken by _thread_monitor_exit().

Aligns x86 code with the approach used on other architectures.

Revises the associated comments and removes unnecessary
doxygen tags.

Change-Id: Ied1aebcd476afb82f61862b77264efb8a7dc66c9
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
This commit is contained in:
Allan Stephens 2016-10-25 09:30:19 -05:00 committed by Andrew Boie
commit 2220f25f0a
4 changed files with 40 additions and 85 deletions

View file

@ -49,6 +49,25 @@ 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 tcs *tcs)
{
unsigned int key;
key = irq_lock();
tcs->next_thread = _nanokernel.threads;
_nanokernel.threads = tcs;
irq_unlock(key);
}
#else
#define thread_monitor_init(tcs) \
do {/* do nothing */ \
} while ((0))
#endif /* CONFIG_THREAD_MONITOR */
/**
*
* @brief Initialize a new execution thread
@ -207,23 +226,7 @@ static void _new_thread_internal(char *pStackMem, unsigned stackSize,
PRINTK("\nstruct tcs * = 0x%x", tcs);
#if defined(CONFIG_THREAD_MONITOR)
{
unsigned int imask;
/*
* 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: both tasks and fibers regardless of whether they are
* runnable.
*/
imask = irq_lock();
tcs->next_thread = _nanokernel.threads;
_nanokernel.threads = tcs;
irq_unlock(imask);
}
#endif /* CONFIG_THREAD_MONITOR */
thread_monitor_init(tcs);
_nano_timeout_tcs_init(tcs);
}