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:
parent
92e75040a2
commit
2220f25f0a
4 changed files with 40 additions and 85 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -34,40 +34,22 @@
|
|||
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 /* thread */
|
||||
)
|
||||
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 */
|
||||
|
||||
/**
|
||||
|
@ -171,5 +153,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);
|
||||
}
|
||||
|
|
|
@ -21,38 +21,23 @@
|
|||
|
||||
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 */
|
||||
|
||||
/* forward declaration to asm function to adjust setup the arguments
|
||||
|
@ -131,5 +116,5 @@ void _new_thread(char *stack_memory, unsigned stack_size,
|
|||
_nano_timeout_tcs_init(tcs);
|
||||
#endif
|
||||
|
||||
THREAD_MONITOR_INIT(tcs);
|
||||
thread_monitor_init(tcs);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue