Can you use select? It is usually used to wait for I / O to complete, but look at the signature:
select.select(rlist, wlist, xlist[, timeout])
So you can do something like:
timeout = 30.0 while true: if select.select([], [], [], timeout):
source share