From cd4d9cf52441dda89e1939ad1bcaaea7829885ad Mon Sep 17 00:00:00 2001 From: Florian Schmaus <flow@cs.fau.de> Date: Mon, 3 May 2021 12:09:48 +0200 Subject: [PATCH] [Blockable] Support worker affinity in PrivateSemaphore.signalFromAnywhere() --- emper/Blockable.hpp | 4 +++- emper/PrivateSemaphore.hpp | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/emper/Blockable.hpp b/emper/Blockable.hpp index d0bef641..90a51a93 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 8c19341d..cc9bf970 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()) { -- GitLab