i need to use select() on a bool because the module pygame.midi lets you know when a midi message is ready only through the function Input.poll() that returns a bool.
if i check this value in the simple way, i do busy waiting and my cpu works at 100% all the time.
is there a way to use the select() or similar functions to wait for a variable to change its value in a context without automatic event raising?
(i don't strictly need to live eventless, indeed i would love to use them, but i can't see midi events anywhere in the package..)
If your input doesn't have any way to fire events, you have to check it on a timer.
In most games, your main event loop already has some "frame limiter" code, so the event loop runs no more than 50 times/sec. So, you can just poll once per event loop. If not, you'll essentially have to add a frame limiter now.
If your game for some reason doesn't fit this paradigm—or if you need to poll the input much more often than your max frame rate—you have to write a background thread that reads from the input (blocking if possible, polling and sleeping if not) and either handles the events directly, or pushes then onto a queue that the main thread can read from each time through the loop.
python - select() on boolean variable