mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-24 22:03:07 +00:00
Handle interruptions and retries of read(2) and write(2)
This commit is contained in:
committed by
Guangli Dai
parent
48b4ad60a7
commit
9fdc1160c5
@@ -96,6 +96,11 @@ malloc_write_fd(int fd, const void *buf, size_t count) {
|
|||||||
&((const byte_t *)buf)[bytes_written],
|
&((const byte_t *)buf)[bytes_written],
|
||||||
count - bytes_written);
|
count - bytes_written);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
|
#ifndef _WIN32
|
||||||
|
if (errno == EINTR) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
bytes_written += result;
|
bytes_written += result;
|
||||||
@@ -124,6 +129,11 @@ malloc_read_fd(int fd, void *buf, size_t count) {
|
|||||||
ssize_t result = malloc_read_fd_syscall(
|
ssize_t result = malloc_read_fd_syscall(
|
||||||
fd, &((byte_t *)buf)[bytes_read], count - bytes_read);
|
fd, &((byte_t *)buf)[bytes_read], count - bytes_read);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
|
#ifndef _WIN32
|
||||||
|
if (errno == EINTR) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
} else if (result == 0) {
|
} else if (result == 0) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user