diff --git a/emper/Blockable.hpp b/emper/Blockable.hpp index d0bef641b188eeb888e7752fe60651f83167317c..90a51a9332478848636b9fdb1c3d0890cce5cf49 100644 --- a/emper/Blockable.hpp +++ b/emper/Blockable.hpp @@ -22,6 +22,8 @@ class Blockable : public Logger<logSubsystem> { ContextManager& contextManager; + workeraffinity_t* affinity = nullptr; + Blockable(Runtime& runtime) : runtime(runtime), contextManager(runtime.getContextManager()) {} // Older clang-tidy versions show a @@ -47,7 +49,7 @@ class Blockable : public Logger<logSubsystem> { blockedContexts.erase(context); } - return Fiber::from([this, context]() { contextManager.discardAndResume(context); }); + return Fiber::from([this, context]() { contextManager.discardAndResume(context); }, affinity); } template <CallerEnvironment callerEnvironment = CallerEnvironment::EMPER> diff --git a/emper/PrivateSemaphore.hpp b/emper/PrivateSemaphore.hpp index 8c19341d4e772fb46e3d0661b3ce1ce2f273d41c..cc9bf9702733735112609004d5d1ccaf6c15dfab 100644 --- a/emper/PrivateSemaphore.hpp +++ b/emper/PrivateSemaphore.hpp @@ -46,7 +46,10 @@ class PrivateSemaphore : protected Blockable<LogSubsystem::PS> { return nullptr; } - void signalFromAnywhere() { signal<CallerEnvironment::ANYWHERE>(); } + void signalFromAnywhere(workeraffinity_t* affinity = nullptr) { + this->affinity = affinity; + signal<CallerEnvironment::ANYWHERE>(); + } void signalAndExit() { if (Context* readyContext = signalInternal()) {