#include
void handler(int)
{
exit(42);
}
void _set_handler(int sig)
{
struct sigaction sact;
sact.sa_handler = &handler;
sigaction(sig, &sact, nullptr);
}
template<int... I>
void set_handler(I... signals)
{
[](...){}( (_set_handler(signals),0)... );
}
int main()
{
set_handler(SIGTERM, SIGINT);
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.