3

在多线程应用程序中,所有线程都会阻塞所有信号,并且单个线程使用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 */
}
4

1 回答 1

3

EINTR仅当系统调用被信号处理程序中断时才返回。如果所有信号都被阻止在进行系统调用的线程的信号掩码中,则不会发生这种情况。

于 2012-08-15T06:40:34.837 回答