Skip to content

Commit

Permalink
unified: Rename ESSENTIAL to K_ESSENTIAL
Browse files Browse the repository at this point in the history
Adds standard prefix to symbolic option that flags a thread
as essential to system operation.

Change-Id: Ia904a81ce343fdd1cd44caaaeae641d822777f9b
Signed-off-by: Allan Stephens <[email protected]>
  • Loading branch information
ajstephens authored and Anas Nashif committed Nov 4, 2016
1 parent 4b75431 commit a3f3de3
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion arch/arc/core/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static ALWAYS_INLINE void thread_monitor_init(struct tcs *tcs)
* @param parameter2 second param to entry point
* @param parameter3 third param to entry point
* @param priority thread priority
* @param options thread options: ESSENTIAL
* @param options thread options: K_ESSENTIAL
*
* @return N/A
*/
Expand Down
2 changes: 1 addition & 1 deletion arch/arc/include/nano_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ typedef struct callee_saved tCalleeSaved;
#endif

#define USE_FP 0x010 /* 1 = thread uses floating point unit */
#define ESSENTIAL 0x200 /* 1 = system thread that must not abort */
#define K_ESSENTIAL 0x200 /* 1 = system thread that must not abort */
#define NO_METRICS 0x400 /* 1 = _Swap() not to update task metrics */

/* stacks */
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/core/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static ALWAYS_INLINE void thread_monitor_init(struct tcs *tcs)
* @param parameter2 entry point to the second param
* @param parameter3 entry point to the third param
* @param priority thread priority
* @param options thread options: ESSENTIAL, USE_FP
* @param options thread options: K_ESSENTIAL, USE_FP
*
* @return N/A
*/
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/include/nano_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ typedef struct preempt tPreempt;
#endif

#define USE_FP 0x010 /* 1 = thread uses floating point unit */
#define ESSENTIAL 0x200 /* 1 = system thread that must not abort */
#define K_ESSENTIAL 0x200 /* 1 = system thread that must not abort */
#define NO_METRICS 0x400 /* 1 = _Swap() not to update task metrics */

/* stacks */
Expand Down
2 changes: 1 addition & 1 deletion arch/nios2/include/nano_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ extern "C" {
#define INT_ACTIVE 0x002 /* 1 = executing context is interrupt handler */
#define EXC_ACTIVE 0x004 /* 1 = executing context is exception handler */
#define USE_FP 0x010 /* 1 = thread uses floating point unit */
#define ESSENTIAL 0x200 /* 1 = system thread that must not abort */
#define K_ESSENTIAL 0x200 /* 1 = system thread that must not abort */
#define NO_METRICS 0x400 /* 1 = _Swap() not to update task metrics */

/* stacks */
Expand Down
4 changes: 2 additions & 2 deletions arch/x86/core/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static ALWAYS_INLINE void thread_monitor_init(struct tcs *tcs)
* @param pStackMem pointer to thread stack memory
* @param stackSize size of a stack in bytes
* @param priority thread priority
* @param options thread options: ESSENTIAL, USE_FP, USE_SSE
* @param options thread options: K_ESSENTIAL, USE_FP, USE_SSE
*
* @return N/A
*/
Expand Down Expand Up @@ -325,7 +325,7 @@ __asm__("\t.globl _thread_entry\n"
* @param parameter2 second param to entry point
* @param parameter3 third param to entry point
* @param priority thread priority
* @param options thread options: ESSENTIAL, USE_FP, USE_SSE
* @param options thread options: K_ESSENTIAL, USE_FP, USE_SSE
*
*
* @return opaque pointer to initialized TCS structure
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/include/nano_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
#define EXC_ACTIVE 0x4 /* 1 = executing context is exception handler */
#define USE_FP 0x10 /* 1 = thread uses floating point unit */
#define USE_SSE 0x20 /* 1 = thread uses SSEx instructions */
#define ESSENTIAL 0x200 /* 1 = system thread that must not abort */
#define K_ESSENTIAL 0x200 /* 1 = system thread that must not abort */
#define NO_METRICS 0x400 /* 1 = _Swap() not to update task metrics */
#define NO_METRICS_BIT_OFFSET 0xa /* Bit position of NO_METRICS */

Expand Down
2 changes: 1 addition & 1 deletion doc/kernel_v2/threads/lifecycle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ A thread that requires a thread option specifies it by name, using the

The following thread options are supported.

:c:macro:`ESSENTIAL`
:c:macro:`K_ESSENTIAL`
This option tags the thread as an :dfn:`essential thread`. This instructs
the kernel to treat the termination or aborting of the thread as a fatal
system error.
Expand Down
6 changes: 3 additions & 3 deletions kernel/nanokernel/nano_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ nano_context_type_t sys_execution_context_type_get(void)
*/
void _thread_essential_set(void)
{
_nanokernel.current->flags |= ESSENTIAL;
_nanokernel.current->flags |= K_ESSENTIAL;
}

/**
Expand All @@ -74,7 +74,7 @@ void _thread_essential_set(void)
*/
void _thread_essential_clear(void)
{
_nanokernel.current->flags &= ~ESSENTIAL;
_nanokernel.current->flags &= ~K_ESSENTIAL;
}

/**
Expand All @@ -88,7 +88,7 @@ void _thread_essential_clear(void)
*/
int _is_thread_essential(void)
{
return _nanokernel.current->flags & ESSENTIAL;
return _nanokernel.current->flags & K_ESSENTIAL;
}

void sys_thread_busy_wait(uint32_t usec_to_wait)
Expand Down
4 changes: 2 additions & 2 deletions kernel/nanokernel/nano_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ static void nano_init(struct tcs *dummyOutContext)
*/
dummyOutContext->link = (struct tcs *)NULL;

dummyOutContext->flags = FIBER | ESSENTIAL;
dummyOutContext->flags = FIBER | K_ESSENTIAL;
dummyOutContext->prio = 0;


Expand Down Expand Up @@ -249,7 +249,7 @@ static void nano_init(struct tcs *dummyOutContext)
* operates on _nanokernel.current, not _nanokernel.task ...
*/

_nanokernel.task->flags |= ESSENTIAL;
_nanokernel.task->flags |= K_ESSENTIAL;

initialize_nano_timeouts();

Expand Down
8 changes: 4 additions & 4 deletions kernel/unified/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ static void _main(void *unused1, void *unused2, void *unused3)

_init_static_threads();

_main_thread->flags &= ~ESSENTIAL;
_main_thread->flags &= ~K_ESSENTIAL;

#ifdef CONFIG_BOOT_TIME_MEASUREMENT
/* record timestamp for kernel's _main() function */
Expand Down Expand Up @@ -249,7 +249,7 @@ static void prepare_multithreading(struct k_thread *dummy_thread)
* Do not insert dummy execution context in the list of fibers, so
* that it does not get scheduled back in once context-switched out.
*/
dummy_thread->flags = ESSENTIAL;
dummy_thread->flags = K_ESSENTIAL;
dummy_thread->prio = K_PRIO_COOP(0);

/* _nanokernel.ready_q is all zeroes */
Expand All @@ -273,13 +273,13 @@ static void prepare_multithreading(struct k_thread *dummy_thread)

_new_thread(main_stack, MAIN_STACK_SIZE, NULL,
_main, NULL, NULL, NULL,
CONFIG_MAIN_THREAD_PRIORITY, ESSENTIAL);
CONFIG_MAIN_THREAD_PRIORITY, K_ESSENTIAL);
_mark_thread_as_started(_main_thread);
_add_thread_to_ready_q(_main_thread);

_new_thread(idle_stack, IDLE_STACK_SIZE, NULL,
idle, NULL, NULL, NULL,
K_LOWEST_THREAD_PRIO, ESSENTIAL);
K_LOWEST_THREAD_PRIO, K_ESSENTIAL);
_mark_thread_as_started(_idle_thread);
_add_thread_to_ready_q(_idle_thread);

Expand Down
6 changes: 3 additions & 3 deletions kernel/unified/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int k_am_in_isr(void)
*/
void _thread_essential_set(void)
{
_current->flags |= ESSENTIAL;
_current->flags |= K_ESSENTIAL;
}

/*
Expand All @@ -77,7 +77,7 @@ void _thread_essential_set(void)
*/
void _thread_essential_clear(void)
{
_current->flags &= ~ESSENTIAL;
_current->flags &= ~K_ESSENTIAL;
}

/*
Expand All @@ -87,7 +87,7 @@ void _thread_essential_clear(void)
*/
int _is_thread_essential(void)
{
return _current->flags & ESSENTIAL;
return _current->flags & K_ESSENTIAL;
}

void k_busy_wait(uint32_t usec_to_wait)
Expand Down

0 comments on commit a3f3de3

Please sign in to comment.