Index: runtime/bin/socket_linux.cc |
diff --git a/runtime/bin/socket_linux.cc b/runtime/bin/socket_linux.cc |
index 2c4a337df21d2b602f8836ab9e0998c561591238..e0ffbf3d2d386b697735365aec92b8f961c715e0 100644 |
--- a/runtime/bin/socket_linux.cc |
+++ b/runtime/bin/socket_linux.cc |
@@ -18,6 +18,7 @@ |
#include "bin/fdutils.h" |
#include "bin/file.h" |
#include "bin/log.h" |
+#include "bin/signal_blocker.h" |
#include "bin/socket.h" |
@@ -106,6 +107,8 @@ intptr_t Socket::Available(intptr_t fd) { |
int Socket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) { |
ASSERT(fd >= 0); |
+ // Block profile interrupts while making I/O call. |
+ ThreadSignalBlocker tsb(SIGPROF); |
ssize_t read_bytes = TEMP_FAILURE_RETRY(read(fd, buffer, num_bytes)); |
ASSERT(EAGAIN == EWOULDBLOCK); |
if (read_bytes == -1 && errno == EWOULDBLOCK) { |
@@ -121,6 +124,8 @@ int Socket::RecvFrom(intptr_t fd, void* buffer, intptr_t num_bytes, |
RawAddr* addr) { |
ASSERT(fd >= 0); |
socklen_t addr_len = sizeof(addr->ss); |
+ // Block profile interrupts while making I/O call. |
+ ThreadSignalBlocker tsb(SIGPROF); |
ssize_t read_bytes = |
TEMP_FAILURE_RETRY( |
recvfrom(fd, buffer, num_bytes, 0, &addr->addr, &addr_len)); |
@@ -135,6 +140,8 @@ int Socket::RecvFrom(intptr_t fd, void* buffer, intptr_t num_bytes, |
int Socket::Write(intptr_t fd, const void* buffer, intptr_t num_bytes) { |
ASSERT(fd >= 0); |
+ // Block profile interrupts while making I/O call. |
+ ThreadSignalBlocker tsb(SIGPROF); |
ssize_t written_bytes = TEMP_FAILURE_RETRY(write(fd, buffer, num_bytes)); |
ASSERT(EAGAIN == EWOULDBLOCK); |
if (written_bytes == -1 && errno == EWOULDBLOCK) { |
@@ -149,6 +156,8 @@ int Socket::Write(intptr_t fd, const void* buffer, intptr_t num_bytes) { |
int Socket::SendTo(intptr_t fd, const void* buffer, intptr_t num_bytes, |
RawAddr addr) { |
ASSERT(fd >= 0); |
+ // Block profile interrupts while making I/O call. |
+ ThreadSignalBlocker tsb(SIGPROF); |
ssize_t written_bytes = |
TEMP_FAILURE_RETRY( |
sendto(fd, buffer, num_bytes, 0, |