kernel: move K_ESSENTIAL from thread_state to execution_flags
The execution_flags will store the user-facing states of a thread. This also fixes a bug where K_ESSENTIAL was already assigned to execution_flags via the options field of k_thread_spawn()/K_THREAD_DEFINE(). Change-Id: I91ad7a62b5d180e09eead8985ff519809959ecf2 Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
This commit is contained in:
parent
a8978aba8f
commit
867f8ee371
3 changed files with 11 additions and 11 deletions
|
@ -24,8 +24,8 @@
|
|||
|
||||
/* states: common uses low bits, arch-specific use high bits */
|
||||
|
||||
/* system thread that must not abort */
|
||||
#define K_ESSENTIAL (1 << 0)
|
||||
/* Not a real thread */
|
||||
#define _THREAD_DUMMY (1 << 0)
|
||||
|
||||
/* Thread is waiting on an object */
|
||||
#define _THREAD_PENDING (1 << 1)
|
||||
|
@ -39,17 +39,17 @@
|
|||
/* Thread is suspended */
|
||||
#define _THREAD_SUSPENDED (1 << 4)
|
||||
|
||||
/* Not a real thread */
|
||||
#define _THREAD_DUMMY (1 << 5)
|
||||
|
||||
/* end - states */
|
||||
|
||||
|
||||
/* execution flags: common uses low bits, arch-specific use high bits */
|
||||
|
||||
/* system thread that must not abort */
|
||||
#define K_ESSENTIAL (1 << 0)
|
||||
|
||||
#if defined(CONFIG_FP_SHARING)
|
||||
/* thread uses floating point registers */
|
||||
#define K_FP_REGS (1 << 0)
|
||||
#define K_FP_REGS (1 << 1)
|
||||
#endif
|
||||
/* end - execution flags */
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ static void _main(void *unused1, void *unused2, void *unused3)
|
|||
main();
|
||||
|
||||
/* Terminate thread normally since it has no more work to do */
|
||||
_main_thread->base.thread_state &= ~K_ESSENTIAL;
|
||||
_main_thread->base.execution_flags &= ~K_ESSENTIAL;
|
||||
}
|
||||
|
||||
void __weak main(void)
|
||||
|
@ -251,7 +251,7 @@ static void prepare_multithreading(struct k_thread *dummy_thread)
|
|||
|
||||
_current = dummy_thread;
|
||||
|
||||
dummy_thread->base.thread_state = K_ESSENTIAL;
|
||||
dummy_thread->base.execution_flags = K_ESSENTIAL;
|
||||
#endif
|
||||
|
||||
/* _kernel.ready_q is all zeroes */
|
||||
|
|
|
@ -77,7 +77,7 @@ int k_is_in_isr(void)
|
|||
*/
|
||||
void _thread_essential_set(void)
|
||||
{
|
||||
_current->base.thread_state |= K_ESSENTIAL;
|
||||
_current->base.execution_flags |= K_ESSENTIAL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -87,7 +87,7 @@ void _thread_essential_set(void)
|
|||
*/
|
||||
void _thread_essential_clear(void)
|
||||
{
|
||||
_current->base.thread_state &= ~K_ESSENTIAL;
|
||||
_current->base.execution_flags &= ~K_ESSENTIAL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -97,7 +97,7 @@ void _thread_essential_clear(void)
|
|||
*/
|
||||
int _is_thread_essential(void)
|
||||
{
|
||||
return _current->base.thread_state & K_ESSENTIAL;
|
||||
return _current->base.execution_flags & K_ESSENTIAL;
|
||||
}
|
||||
|
||||
void k_busy_wait(uint32_t usec_to_wait)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue