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
This commit is contained in:
Norman Feske 2013-05-22 16:32:34 +02:00 committed by Christian Helmuth
parent 86eb3f4a0d
commit db56946ba9
1 changed files with 5 additions and 0 deletions

View File

@ -21,6 +21,7 @@
#include <base/env.h>
#include <base/sleep.h>
#include <os/config.h>
#include <timer_session/connection.h>
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 (...) { }