use sigwait in main-loop