Break inifinite loop waiting for external events with internal timeout.

Timeout is hardcoded, but well, it's proof of concent and better than infinite
loop. With wait timeout of 10s, overall timeout is 1000s, which should be good
enought to avoid spurious triggering and yet be "fail-fast" enough.