native: optionally exit() after last thread has ended
Used when compiled with NATIVE_AUTO_EXIT defined.
This commit is contained in:
parent
3903b8add2
commit
900db3436a
@ -128,3 +128,11 @@ is established.
|
|||||||
|
|
||||||
Socket redirection is only available when the uart module has been
|
Socket redirection is only available when the uart module has been
|
||||||
compiled in.
|
compiled in.
|
||||||
|
|
||||||
|
COMPILE TIME OPTIONS
|
||||||
|
====================
|
||||||
|
|
||||||
|
Compile with
|
||||||
|
CFLAGS=-DNATIVE_AUTO_EXIT make
|
||||||
|
|
||||||
|
to exit the riot core after the last thread has exited.
|
||||||
|
|||||||
@ -151,6 +151,13 @@ void isr_cpu_switch_context_exit(void)
|
|||||||
|
|
||||||
void cpu_switch_context_exit()
|
void cpu_switch_context_exit()
|
||||||
{
|
{
|
||||||
|
#ifdef NATIVE_AUTO_EXIT
|
||||||
|
if (num_tasks <= 1) {
|
||||||
|
DEBUG("cpu_switch_context_exit(): last task has ended. exiting.\n");
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (_native_in_isr == 0) {
|
if (_native_in_isr == 0) {
|
||||||
dINT();
|
dINT();
|
||||||
_native_in_isr = 1;
|
_native_in_isr = 1;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user