Skip to content
Snippets Groups Projects

Fix Actor::waitUntilIdle

Merged Florian Fischer requested to merge aj46ezos/emper:fix_actor_waitUntilIdle into master
1 unresolved thread
Files
14
+ 7
1
@@ -8,6 +8,7 @@
#include "CallerEnvironment.hpp"
#include "Fiber.hpp"
#include "UnboundedBlockingMpscQueue.hpp"
#include "emper.hpp"
template <typename T>
class Actor {
@@ -78,8 +79,13 @@ class Actor {
auto waitUntilIdle(long timeout) -> bool {
const auto start = std::chrono::steady_clock::now();
const auto deadline = start + std::chrono::milliseconds(timeout);
const auto deadline = start + std::chrono::seconds(timeout);
while (!(queue.size() == 0 && state.load(std::memory_order_acquire) == Retrieving)) {
if constexpr (emper::IO) {
emper::sleep(1);
} else {
emper::yield();
}
// TODO: The suppressed linter error below may be a false positive
// reported by clang-tidy.
// NOLINTNEXTLINE(modernize-use-nullptr)
Loading