use sigaction instead of sigwait