hand EINTR in IXSelectInterruptPipe::notify and IXSelectInterruptPipe::read

This commit is contained in:
Benjamin Sergeant 2020-11-16 10:18:53 -08:00
parent fcf114e2b2
commit 60aeaec734

View File

@ -117,8 +117,14 @@ namespace ix
int fd = _fildes[kPipeWriteIndex];
if (fd == -1) return false;
ssize_t ret = -1;
do
{
ret = ::write(fd, &value, sizeof(value));
} while (ret == -1 && errno == EINTR);
// we should write 8 bytes for an uint64_t
return write(fd, &value, sizeof(value)) == 8;
return ret == 8;
}
// TODO: return max uint64_t for errors ?
@ -129,7 +135,12 @@ namespace ix
int fd = _fildes[kPipeReadIndex];
uint64_t value = 0;
::read(fd, &value, sizeof(value));
ssize_t ret = -1;
do
{
ret = ::read(fd, &value, sizeof(value));
} while (ret == -1 && errno == EINTR);
return value;
}