From db56946ba9281d814e7caab72dd2d1a439bd0008 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Wed, 22 May 2013 16:32:34 +0200 Subject: [PATCH] rom_prefetcher: Yield CPU after each request By blocking on a timeout, we yield the CPU in order to give a concurrently running sporadic process a chance to obtain ROM modules. Otherwise, such requests would be deferred until the ROM prefetcher completes its operation or in the unlikely event that the prefetcher gets preempted. Fixes #1378 --- repos/os/src/server/rom_prefetcher/main.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/repos/os/src/server/rom_prefetcher/main.cc b/repos/os/src/server/rom_prefetcher/main.cc index 046e8cb92..9fecf2baf 100644 --- a/repos/os/src/server/rom_prefetcher/main.cc +++ b/repos/os/src/server/rom_prefetcher/main.cc @@ -21,6 +21,7 @@ #include #include #include +#include volatile int dummy; @@ -112,6 +113,7 @@ int main(int argc, char **argv) * Prefetch ROM files specified in the config */ try { + Timer::Connection timer; Genode::Xml_node entry = config()->xml_node().sub_node("rom"); for (;;) { @@ -130,6 +132,9 @@ int main(int argc, char **argv) /* proceed with next XML node */ entry = entry.next("rom"); + + /* yield */ + timer.msleep(1); } } catch (...) { }