Index: runtime/bin/socket.cc |
diff --git a/runtime/bin/socket.cc b/runtime/bin/socket.cc |
index 046bd1855ec6b105678c8ad7499dc0af6dd26d55..a2d0c1bb7d036e62ac032030325e432fae07d7ca 100644 |
--- a/runtime/bin/socket.cc |
+++ b/runtime/bin/socket.cc |
@@ -13,7 +13,7 @@ |
#include "platform/utils.h" |
#include "include/dart_api.h" |
- |
+#include "include/dart_native_api.h" |
namespace dart { |
namespace bin { |
@@ -148,7 +148,9 @@ void FUNCTION_NAME(Socket_Read)(Dart_NativeArguments args) { |
Dart_Handle result = IOBuffer::Allocate(length, &buffer); |
if (Dart_IsError(result)) Dart_PropagateError(result); |
ASSERT(buffer != NULL); |
+ Dart_DisableThreadInterrupter(); |
intptr_t bytes_read = Socket::Read(socket, buffer, length); |
+ Dart_EnableThreadInterrupter(); |
if (bytes_read == length) { |
Dart_SetReturnValue(args, result); |
} else if (bytes_read < length) { |
@@ -203,7 +205,9 @@ void FUNCTION_NAME(Socket_WriteList)(Dart_NativeArguments args) { |
if (Dart_IsError(result)) Dart_PropagateError(result); |
ASSERT((offset + length) <= len); |
buffer += offset; |
+ Dart_DisableThreadInterrupter(); |
intptr_t bytes_written = Socket::Write(socket, buffer, length); |
+ Dart_EnableThreadInterrupter(); |
if (bytes_written >= 0) { |
Dart_TypedDataReleaseData(buffer_obj); |
Dart_SetReturnValue(args, Dart_NewInteger(bytes_written)); |