Fixed thread starting to work correctly

This commit is contained in:
dario
2024-02-07 17:04:19 +01:00
parent 1d1c5f4fc2
commit 554e1ab94e
2 changed files with 26 additions and 2 deletions

View File

@@ -38,6 +38,18 @@ namespace sta
return running_;
}
void TacosThread::start()
{
if (getInstance() == NULL)
{
RtosThread::start();
}
else
{
sysNotify(STA_RTOS_THREAD_FLAG_START);
}
}
void TacosThread::init() {}
void TacosThread::loop()
@@ -59,8 +71,11 @@ namespace sta
while (!isTerminationRequested())
{
#ifdef STA_TACOS_WATCHDOG_ENABLED
// Send a fresh heartbeat signal.
heartbeat();
if (status_ == ThreadStatus::UNKNOWN)
{
// Send a fresh heartbeat signal.
heartbeat();
}
#endif // STA_TACOS_WATCHDOG_ENABLED
// Execute user-space implementation.
@@ -116,6 +131,11 @@ namespace sta
{
status_ = ThreadStatus::UNKNOWN;
}
void TacosThread::watchdogIgnore()
{
status_ = ThreadStatus::IGNORED;
}
#endif // STA_TACOS_WATCHDOG_ENABLED
void TacosThread::requestTermination()