Maj*_*imi 5 c multithreading signals
在多线程应用程序中,所有线程都会阻止所有信号,并且单个线程在循环中执行信号处理sigwait。现在我们应该考虑在其他线程中EINTR使用像read和一样的系统调用吗?write
while (true)
{
num = read(fd, buf, size);
if (num == -1 && errno == EINTR)
continue;
else if (num > 0)
/* handle the buf and read more */
}
Run Code Online (Sandbox Code Playgroud)