Indeed, and I have found that this article helped me to improve my code: http://genodians.org/m-stein/2021-05-31-a-short-guide-to-the-timer-session-i...
But if you're specifically after keyboard/mouse input, you'll probably want to do it with a 'sigh' instead of with polling: install a sigh (signal handler) for keyboard events, and implement its hook function ; e.g. I have this in my code:
class hog::InputBridger
{
private: // Code
void handleOneEvent(
const Input::Event & ev
);
Genode::Entrypoint localEp; // Genode thread dedicated to the sigh
Genode::Signal_handler<InputBridger>
inputHandler;
}
void hog::InputBridger::handleInput()
{
serverInput.for_each_event(
[&] ( Input::Event const & ev )
...
... (handle mouse and keyboard events here)
}
ctor:
serverInput.sigh( inputHandler );
Grepping the genode "repos/" folder will yield lots of examples.
Cedric
You can wait by getting a Timer::Connection and using either the msleep() or usleep() method, depending on whether you have ms or us.
On Thu, Oct 14, 2021, 10:10 AM Kevin Burton kevin.burton@tum.de wrote:
Hello Genodians,
is it possible to have the main thread either sleep for a specific amount of time or have it wait for a keyboard input? If yes, how would I go about implementing it?
I have read online that the Timer service is in charge of sleeps, but I