Merge pull request 'Fixes for termination requests' (#18) from term-request-fix into main

Reviewed-on: https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils/pulls/18
Reviewed-by: carlwachter <carlwachter@noreply.git.intern.spaceteamaachen.de>
This commit is contained in:
carlwachter
2023-12-06 13:53:56 +00:00
2 changed files with 15 additions and 7 deletions

View File

@@ -105,12 +105,17 @@ namespace sta
*/
void requestTermination();
/**
* @brief Clear the termination request flag for this thread.
*/
void deleteTerminationRequest();
/**
* @brief Resets the terminate bool to false.
*
* @return Returns the previous value of this variable.
*/
bool resetTerminationRequest();
bool isTerminationRequested();
/**
* @brief Forcibly terminate thread.

View File

@@ -8,11 +8,13 @@
namespace sta
{
RtosThread::RtosThread()
: handle_(nullptr)
: handle_(nullptr),
terminate_{false}
{}
RtosThread::RtosThread(const Handle & handle)
: handle_{handle}
: handle_{handle},
terminate_{false}
{}
@@ -59,16 +61,17 @@ namespace sta
void RtosThread::requestTermination()
{
// sysNotify(STA_RTOS_THREAD_FLAG_TERMINATE);
terminate_ = true;
}
bool RtosThread::resetTerminationRequest()
void RtosThread::deleteTerminationRequest()
{
bool temp = terminate_;
terminate_ = false;
}
return temp;
bool RtosThread::isTerminationRequested()
{
return terminate_;
}
void RtosThread::terminate()