I have a python script that waits for output/events from other applications by sitting in a while loop. However, this seems to be taking way too much cpu load (50%). Is there some method to lower it? Adding sleep intervals in there helps, but i'd rather not use it.
i am not an experts in python, but as far as i remember select will work on operating system
object that can be signalled. that is, if you are wiating for something specific yuo designed it might not work, but if you are waiting on a sockt/pipe/sync object than you could probably use select.
i am not sure this answer is a hundred percent correct, but you should check exactly what select does
and how it works, and perhaps it will be the best option for you.
another option is using os.sys.WaitForSingleObject (once again, i am not sure this is the exact heirarchy, but the function is a win32 api function called WaitForSingleObject.
Awesome, thanks guys, I'll give select a try. I've used it before when managing multiple socket connections in C; I wonder why it slipped my mind.