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

@ -42,38 +42,23 @@ struct init_stack_frame {
tNANO _nanokernel = {0};
#if defined(CONFIG_THREAD_MONITOR)
#define THREAD_MONITOR_INIT(tcs) thread_monitor_init(tcs)
#else
#define THREAD_MONITOR_INIT(tcs) \
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
* Add a thread to the kernel's list of active threads.
*/
static ALWAYS_INLINE void thread_monitor_init(struct tcs *tcs)
{
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:
* both tasks and fibers regardless of whether they are runnable.
*/
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 */
/*
@ -187,5 +172,5 @@ void _new_thread(char *pStackMem, unsigned stackSize,
/* initial values in all other registers/TCS entries are irrelevant */
THREAD_MONITOR_INIT(tcs);
thread_monitor_init(tcs);
}