Am I over-engineering per-thread signal blocking?

血红的双手。 提交于 2019-12-04 04:57:15

I find it a perfectly reasonable thing to do.

You could block the signals in main, before any other thread is spawned. The spawned threads will inherit the creator thread signal mask and you can unblock signals only in the signal handling thread (being careful only if that thread spawns other threads as well).

Or you can leave the signals blocked everywhere and explicitly handle them via sigwait and friends in the signal handling thread.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!