mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 13:47:56 +00:00
Omit timer RPC calls for usleep(0)
This commit is contained in:
parent
77cba65b7a
commit
87f13d77c0
@ -55,6 +55,17 @@ class Timer::Connection : public Genode::Connection<Session>, 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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user