I am registering an alarm signal handler as follows and an alarm signal is set every second.
sigact.sa_handler = time_handler;
sigemptyset(&sigact.sa_mask);
sigact.sa_flags = SA_RESTART;
if (sigaction(SIGALRM, &sigact, NULL) < 0)
panic("sigaction SIGALRM: %s\n", strerror(errno));
/* Set alarm signal every second */
alarm(1);
My question is does the function time_handler
follow a separate execution path like a thread or does it block the main process.
您可以通过在回调中添加sleep()来查看是否正在使用GNU C,然后查看之后的代码是否延迟。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.