hand EINTR in IXSelectInterruptPipe::notify and IXSelectInterruptPipe::read
This commit is contained in:
parent
fcf114e2b2
commit
60aeaec734
@ -117,8 +117,14 @@ namespace ix
|
|||||||
int fd = _fildes[kPipeWriteIndex];
|
int fd = _fildes[kPipeWriteIndex];
|
||||||
if (fd == -1) return false;
|
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
|
// 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 ?
|
// TODO: return max uint64_t for errors ?
|
||||||
@ -129,7 +135,12 @@ namespace ix
|
|||||||
int fd = _fildes[kPipeReadIndex];
|
int fd = _fildes[kPipeReadIndex];
|
||||||
|
|
||||||
uint64_t value = 0;
|
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;
|
return value;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user