Don't use ThreadSignalBlocker in mac eventhandler.
Turns out kevent can modify the current sigmask.
BUG=
R=ricow@google.com
Review URL: https://codereview.chromium.org//212193002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34408 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/runtime/bin/eventhandler_macos.cc b/runtime/bin/eventhandler_macos.cc
index d4d4686..1da8702 100644
--- a/runtime/bin/eventhandler_macos.cc
+++ b/runtime/bin/eventhandler_macos.cc
@@ -179,7 +179,7 @@
void EventHandlerImplementation::HandleInterruptFd() {
const intptr_t MAX_MESSAGES = kInterruptMessageSize;
InterruptMessage msg[MAX_MESSAGES];
- ssize_t bytes = TEMP_FAILURE_RETRY_NO_SIGNAL_BLOCKER(
+ ssize_t bytes = TEMP_FAILURE_RETRY(
read(interrupt_fds_[0], msg, MAX_MESSAGES * kInterruptMessageSize));
for (ssize_t i = 0; i < bytes / kInterruptMessageSize; i++) {
if (msg[i].id == kTimerId) {
@@ -201,7 +201,7 @@
// Close the socket and free system resources.
RemoveFromKqueue(kqueue_fd_, sd);
intptr_t fd = sd->fd();
- sd->Close();
+ VOID_TEMP_FAILURE_RETRY(close(fd));
socket_map_.Remove(GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd));
delete sd;
DartUtils::PostInt32(msg[i].dart_port, 1 << kDestroyedEvent);
@@ -351,7 +351,6 @@
void EventHandlerImplementation::EventHandlerEntry(uword args) {
- ThreadSignalBlocker signal_blocker(SIGPROF);
static const intptr_t kMaxEvents = 16;
struct kevent events[kMaxEvents];
EventHandler* handler = reinterpret_cast<EventHandler*>(args);
@@ -372,7 +371,9 @@
ts.tv_nsec = (millis32 - (secs * 1000)) * 1000000;
timeout = &ts;
}
- intptr_t result = TEMP_FAILURE_RETRY_NO_SIGNAL_BLOCKER(
+ // We have to use TEMP_FAILURE_RETRY for mac, as kevent can modify the
+ // current sigmask.
+ intptr_t result = TEMP_FAILURE_RETRY(
kevent(handler_impl->kqueue_fd_, NULL, 0, events, kMaxEvents, timeout));
if (result == -1) {
const int kBufferSize = 1024;
diff --git a/runtime/bin/eventhandler_macos.h b/runtime/bin/eventhandler_macos.h
index 4ea1a01..4e32dc0 100644
--- a/runtime/bin/eventhandler_macos.h
+++ b/runtime/bin/eventhandler_macos.h
@@ -43,13 +43,6 @@
bool HasReadEvent();
bool HasWriteEvent();
- void Close() {
- port_ = 0;
- mask_ = 0;
- VOID_TEMP_FAILURE_RETRY(close(fd_));
- fd_ = -1;
- }
-
bool IsListeningSocket() { return (mask_ & (1 << kListeningSocket)) != 0; }
void SetPortAndMask(Dart_Port port, intptr_t mask) {