Skip to content
Snippets Groups Projects
Commit 72d0d3b7 authored by Florian Schmaus's avatar Florian Schmaus
Browse files

Merge branch 'scheduleOnTest-wo-io' into 'master'

[ScheduleOnTest] block worker thread if IO is not available

See merge request i4/manycore/emper!315
parents f76dea98 d3073b6c
No related branches found
No related tags found
No related merge requests found
......@@ -125,6 +125,10 @@ clang-tidy:
variables:
EMPER_USERSPACE_RCU: 'true'
.emper-no-io:
variables:
EMPER_IO: 'false'
.emper-pipe-sleep-strategy:
variables:
EMPER_WORKER_SLEEP_STRATEGY: 'pipe'
......@@ -369,6 +373,11 @@ test-mmapped-log:
- .meson-test
script: make && EMPER_LOG_FILE=emper.log make test
test-no-io:
extends:
- .test
- .emper-no-io
test-single-uring:
extends:
- .test
......
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright © 2021 Florian Fischer
#include <chrono>
#include <thread>
#include "CountingPrivateSemaphore.hpp"
#include "Emper.hpp"
#include "Fiber.hpp"
#include "Runtime.hpp"
#include "Worker.hpp"
......@@ -25,7 +29,12 @@ static void scheduleOnTest() {
ASSERT(runtime);
workerCount = runtime->getWorkerCount();
// Wait so all workers can suspend themselves
if constexpr (emper::IO) {
emper::sleep(1);
} else { // We can not sleep using emper mechanisms -> block the worker thread
std::this_thread::sleep_for(std::chrono::seconds(1));
}
CPS cps(1);
runtime->scheduleOn(*Fiber::from([&] { runOn(cps); }), (iteration % workerCount));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment