mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-04-14 14:41:42 +03:00
Handle interruptions and retries of read(2) and write(2)
This commit is contained in:
parent
e74d9fb73d
commit
8a231568f9
1 changed files with 10 additions and 0 deletions
|
|
@ -96,6 +96,11 @@ malloc_write_fd(int fd, const void *buf, size_t count) {
|
|||
&((const byte_t *)buf)[bytes_written],
|
||||
count - bytes_written);
|
||||
if (result < 0) {
|
||||
#ifndef _WIN32
|
||||
if (errno == EINTR) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
return 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(
|
||||
fd, &((byte_t *)buf)[bytes_read], count - bytes_read);
|
||||
if (result < 0) {
|
||||
#ifndef _WIN32
|
||||
if (errno == EINTR) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
} else if (result == 0) {
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue