更新时间:2023-11-17 13:39:46
您可能想看看 Sys :: SigAction .我本人还没有使用过它,但是它有一些发光的评论.
You probably want to look at Sys::SigAction. I haven't used it myself, but it has some glowing reviews.
要注意的一件事是,可能超时的东西"是使用sleep
还是alarm
本身.另外,在错误处理代码中,我假设您已经为超时以外的错误做好了准备.
One thing to watch out for is if "stuff that might timeout" uses sleep
or alarm
itself. Also, in the error handling code, I assume you're prepared for errors other than a timeout.