mirror of
https://github.com/kelvinlawson/atomthreads.git
synced 2026-04-19 02:09:04 +02:00
atomkernel: Support thread entry points running to completion. Ports which use a thread_shell() can allow the entry point to finish and return back to the thread_shell(), which sets the terminated flag and calls the scheduler to force another thread to be scheduled in. Currently implemented in the ARM and AVR ports.
This commit is contained in:
@@ -77,6 +77,7 @@ typedef struct atom_tcb
|
||||
uint8_t suspended; /* TRUE if task is currently suspended */
|
||||
uint8_t suspend_wake_status; /* Status returned to woken suspend calls */
|
||||
ATOM_TIMER *suspend_timo_cb; /* Callback registered for suspension timeouts */
|
||||
uint8_t terminated; /* TRUE if task is being terminated (run to completion) */
|
||||
|
||||
/* Details used if thread stack-checking is required */
|
||||
#ifdef ATOM_STACK_CHECKING
|
||||
|
||||
@@ -241,10 +241,11 @@ void atomSched (uint8_t timer_tick)
|
||||
CRITICAL_START ();
|
||||
|
||||
/**
|
||||
* If the current thread is going into suspension, then
|
||||
* unconditionally dequeue the next thread for execution.
|
||||
* If the current thread is going into suspension or is being
|
||||
* terminated (run to completion), then unconditionally dequeue
|
||||
* the next thread for execution.
|
||||
*/
|
||||
if (curr_tcb->suspended == TRUE)
|
||||
if ((curr_tcb->suspended == TRUE) || (curr_tcb->terminated == TRUE))
|
||||
{
|
||||
/**
|
||||
* Dequeue the next ready to run thread. There will always be
|
||||
|
||||
Reference in New Issue
Block a user