diff --git a/emper/sleep_strategy/SemaphoreWorkerSleepStrategy.hpp b/emper/sleep_strategy/SemaphoreWorkerSleepStrategy.hpp index 40b4b11ca4ffb8822b3eeba55ae3353f3cfe6a4c..176fe412636d3c316aa61928c7c8f140090fb3c5 100644 --- a/emper/sleep_strategy/SemaphoreWorkerSleepStrategy.hpp +++ b/emper/sleep_strategy/SemaphoreWorkerSleepStrategy.hpp @@ -160,7 +160,12 @@ class AbstractSemaphoreWorkerSleepStrategy * reviewed and potentially changed to '-1'. * skipWakeupThreshold = 0; */ - const typename Sem::CounterType skipWakeupThreshold = workerCount; + typename Sem::CounterType skipWakeupThreshold; + if constexpr (callerEnvironment == CallerEnvironment::ANYWHERE) { + skipWakeupThreshold = workerCount; + } else { + skipWakeupThreshold = EMPER_SLEEP_SEM_THRESHOLD; + } auto semValue = wakeupSem.getValue(); return semValue <= skipWakeupThreshold; diff --git a/meson.build b/meson.build index 36c3553106f93bd91cc7c8cf7cfb4af861febf23..e97c319626408057f88c4a3fb01fe9d685bcf705 100644 --- a/meson.build +++ b/meson.build @@ -89,6 +89,7 @@ else endif +conf_data.set('EMPER_SLEEP_SEM_THRESHOLD', get_option('sleep_sem_threshold')) conf_data.set('EMPER_WORKER_SLEEP', get_option('worker_sleep')) conf_data.set('EMPER_WORKER_WAKEUP_STRATEGY', get_option('worker_wakeup_strategy')) conf_data.set('EMPER_WORKER_IGNORE_WAKEUP_HINT', get_option('worker_ignore_wakeup_hint')) diff --git a/meson_options.txt b/meson_options.txt index 8ba72e61a6bdb6903e9f2990f708faaef2b01926..3ec221d6eb1660399f3709ca6a9b1869870bf6bc 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,3 +1,10 @@ +option( + 'sleep_sem_threshold', + type: 'combo', + choices: ['0', 'workerCount'], + value: 'workerCount', + description: 'Threshold skipping the notification' +) option( 'use_bundled_deps', type: 'combo',