From 87f13d77c0627ef45b7a0503516ea7fa91e052f5 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Sat, 4 Apr 2015 17:57:26 +0200 Subject: [PATCH] Omit timer RPC calls for usleep(0) --- repos/os/include/timer_session/connection.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/repos/os/include/timer_session/connection.h b/repos/os/include/timer_session/connection.h index 2f63881f3..ba48b7c99 100644 --- a/repos/os/include/timer_session/connection.h +++ b/repos/os/include/timer_session/connection.h @@ -55,6 +55,17 @@ class Timer::Connection : public Genode::Connection, public Session_cli void usleep(unsigned us) { + /* + * Omit the interaction with the timer driver for the corner case + * of not sleeping at all. This corner case may be triggered when + * polling is combined with sleeping (as some device drivers do). + * If we passed the sleep operation to the timer driver, the + * timer would apply its policy about a minimum sleep time to + * the sleep operation, which is not desired when polling. + */ + if (us == 0) + return; + /* serialize sleep calls issued by different threads */ Genode::Lock::Guard guard(_lock);