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:
parent
86eb3f4a0d
commit
db56946ba9
|
@ -21,6 +21,7 @@
|
||||||
#include <base/env.h>
|
#include <base/env.h>
|
||||||
#include <base/sleep.h>
|
#include <base/sleep.h>
|
||||||
#include <os/config.h>
|
#include <os/config.h>
|
||||||
|
#include <timer_session/connection.h>
|
||||||
|
|
||||||
volatile int dummy;
|
volatile int dummy;
|
||||||
|
|
||||||
|
@ -112,6 +113,7 @@ int main(int argc, char **argv)
|
||||||
* Prefetch ROM files specified in the config
|
* Prefetch ROM files specified in the config
|
||||||
*/
|
*/
|
||||||
try {
|
try {
|
||||||
|
Timer::Connection timer;
|
||||||
Genode::Xml_node entry = config()->xml_node().sub_node("rom");
|
Genode::Xml_node entry = config()->xml_node().sub_node("rom");
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
||||||
|
@ -130,6 +132,9 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
/* proceed with next XML node */
|
/* proceed with next XML node */
|
||||||
entry = entry.next("rom");
|
entry = entry.next("rom");
|
||||||
|
|
||||||
|
/* yield */
|
||||||
|
timer.msleep(1);
|
||||||
}
|
}
|
||||||
} catch (...) { }
|
} catch (...) { }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue