Added working blocking-wrapper

This commit is contained in:
dario 2024-01-03 15:17:38 +01:00
parent 05ddf1fb03
commit 12d6303f2e
3 changed files with 13 additions and 6 deletions

View File

@ -127,7 +127,14 @@ namespace sta
virtual void cleanup();
#ifdef STA_TACOS_WATCHDOG_ENABLED
#define BLOCKING(stmt) waiting(); stmt heartbeat()
/**
* @brief This macro wraps a given statement into waiting() and heartbeat() to make the code more readable.
*
*/
#define blocking(...) \
waiting(); \
__VA_ARGS__ \
heartbeat(); \
protected:
/**

View File

@ -23,9 +23,9 @@ namespace sta
: RtosThread(RtosHandle<osThreadId_t>(Handle::Deferred(&instance_))),
instance_{ NULL },
attribs_{ .name = name, .priority = prio },
running_{false},
running_{false}
#ifdef STA_TACOS_WATCHDOG_ENABLED
status_{ThreadStatus::STOPPED}
, status_{ThreadStatus::STOPPED}
#endif // STA_TACOS_WATCHDOG_ENABLED
{}
@ -33,9 +33,9 @@ namespace sta
: RtosThread(RtosHandle<osThreadId_t>(Handle::Deferred(&instance_))),
instance_{ NULL },
attribs_{ },
running_{false},
running_{false}
#ifdef STA_TACOS_WATCHDOG_ENABLED
status_{ThreadStatus::STOPPED}
, status_{ThreadStatus::STOPPED}
#endif // STA_TACOS_WATCHDOG_ENABLED
{}