diff --git a/Threads/Inc/threads_actor.hpp b/Threads/Inc/threads_actor.hpp index 71aace1..607615a 100644 --- a/Threads/Inc/threads_actor.hpp +++ b/Threads/Inc/threads_actor.hpp @@ -32,11 +32,7 @@ public: static_assert(std::is_trivially_copyable_v, "Ts must be trivially copyable."); Actor(const std::uint32_t queue_size, const char* name, const osPriority_t priority, const std::uint32_t stack_size) - : thread_([](void* d) { - auto* dd = static_cast*>(d); - (*dd)(); - }, - this, name, priority, stack_size), + : thread_(&Actor::threadHandler_, this, name, priority, stack_size), msg_queue_(xQueueCreate(queue_size, sizeof(value_type))), signal_(this) { assert(msg_queue_); @@ -129,6 +125,12 @@ private: } } + static void threadHandler_(void* d) + { + auto* dd = static_cast*>(d); + (*dd)(); + } + Signal signal_; }; diff --git a/Threads/Src/threads_timer.cpp b/Threads/Src/threads_timer.cpp index 0007450..3ea7d47 100644 --- a/Threads/Src/threads_timer.cpp +++ b/Threads/Src/threads_timer.cpp @@ -82,7 +82,8 @@ void Timer::timeoutHandler_(TimerHandle_t timer) if (!source) return; - static_cast(source)->signal_->emit(TimeoutSignal{}); + auto* d = static_cast(source); + d->signal_->emit(TimeoutSignal{}); } }// namespace Threads