kernel: Cleanup, unify _add_thread_to_ready_q() and _ready_thread()
The scheduler exposed two APIs to do the same thing: _add_thread_to_ready_q() was a low level primitive that in most cases was wrapped by _ready_thread(), which also (1) checks that the thread _is_ready() or exits, (2) flags the thread as "started" to handle the case of a thread running for the first time out of a waitq timeout, and (3) signals a logger event. As it turns out, all existing usage was already checking case #1. Case #2 can be better handled in the timeout resume path instead of on every call. And case #3 was probably wrong to have been skipping anyway (there were paths that could make a thread runnable without logging). Now _add_thread_to_ready_q() is an internal scheduler API, as it probably always should have been. This also moves some asserts from the inline _ready_thread() wrapper to the underlying true function for code size reasons, otherwise the extra use of the inline added by this patch blows past code size limits on Quark D2000. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
parent
c7ceef6751
commit
85bc0a3fe6
6 changed files with 19 additions and 32 deletions
|
@ -418,21 +418,6 @@ static inline void _mark_thread_as_started(struct k_thread *thread)
|
|||
*/
|
||||
static inline void _ready_thread(struct k_thread *thread)
|
||||
{
|
||||
__ASSERT(_is_prio_higher(thread->base.prio, K_LOWEST_THREAD_PRIO) ||
|
||||
((thread->base.prio == K_LOWEST_THREAD_PRIO) &&
|
||||
(thread == _idle_thread)),
|
||||
"thread %p prio too low (is %d, cannot be lower than %d)",
|
||||
thread, thread->base.prio,
|
||||
thread == _idle_thread ? K_LOWEST_THREAD_PRIO :
|
||||
K_LOWEST_APPLICATION_THREAD_PRIO);
|
||||
|
||||
__ASSERT(!_is_prio_higher(thread->base.prio, K_HIGHEST_THREAD_PRIO),
|
||||
"thread %p prio too high (id %d, cannot be higher than %d)",
|
||||
thread, thread->base.prio, K_HIGHEST_THREAD_PRIO);
|
||||
|
||||
/* needed to handle the start-with-delay case */
|
||||
_mark_thread_as_started(thread);
|
||||
|
||||
if (_is_thread_ready(thread)) {
|
||||
_add_thread_to_ready_q(thread);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue