From d591560c95a4eae525cbbbdb4e4bc15642852473 Mon Sep 17 00:00:00 2001 From: dario Date: Sun, 15 Oct 2023 22:13:25 +0200 Subject: [PATCH] Added method for reading thread flags --- include/sta/rtos/thread.hpp | 5 +++++ src/thread.cpp | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/include/sta/rtos/thread.hpp b/include/sta/rtos/thread.hpp index 8378c87..f7d8f2d 100644 --- a/include/sta/rtos/thread.hpp +++ b/include/sta/rtos/thread.hpp @@ -81,6 +81,11 @@ namespace sta */ void notify(uint32_t flags); + /** + * @return Returns the flags that were set for this thread. + */ + uint32_t getFlags(); + /** * @brief Send termination request to thread. */ diff --git a/src/thread.cpp b/src/thread.cpp index 781f0d1..0694858 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -32,6 +32,12 @@ namespace sta osThreadFlagsSet(handle_.get(), flags); } + uint32_t RtosThread::getFlags() + { + STA_ASSERT(handle_.get() != nullptr); + + return osThreadFlagsGet(); + } void RtosThread::requestTermination() {