Changed TacosThread termination to work correctly; fixed bugs in the testing

This commit is contained in:
dario
2023-11-29 20:12:45 +01:00
committed by carlwachter
parent a70dc00f4c
commit 2b4e634179
7 changed files with 22 additions and 15 deletions

View File

@@ -81,21 +81,26 @@ namespace sta
// Infinite loop allowing quick restarts of this thread after termination.
while (true)
{
// The thread has to wait until the startup has been completed.
// The thread has to wait until the system startup has been completed.
rtos::waitForStartupEvent();
// Wait for a thread start flag.
wait(STA_RTOS_THREAD_FLAG_START);
// Call user-defined initialization code.
running_ = true;
init();
// Run the thread until the termination flag is set.
while (!resetTerminationRequest())
// Run the thread until the termination flag is set. Reset this
while (!isTerminationRequested())
{
func();
}
// Clear the termination request flag for this thread.
deleteTerminationRequest();
// Call user-defined cleanup code.
cleanup();
running_ = false;
}