From 9eb5ca1421382ed05e39790d41eb5e2c6e63e5ce Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 14 Jun 2019 13:31:54 -0700 Subject: [PATCH] Handle EINTR in the apple version of ExternalCommitHelper We just want to re-call kevent when it happens. The epoll version already did this. --- src/impl/apple/external_commit_helper.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/impl/apple/external_commit_helper.cpp b/src/impl/apple/external_commit_helper.cpp index 6b166c128..5c4618926 100644 --- a/src/impl/apple/external_commit_helper.cpp +++ b/src/impl/apple/external_commit_helper.cpp @@ -196,7 +196,7 @@ ExternalCommitHelper::~ExternalCommitHelper() void ExternalCommitHelper::listen() { - pthread_setname_np("RLMRealm notification listener"); + pthread_setname_np("Realm notification listener"); // Set up the kqueue // EVFILT_READ indicates that we care about data being available to read @@ -214,11 +214,11 @@ void ExternalCommitHelper::listen() // Wait for data to become on either fd // Return code is number of bytes available or -1 on error ret = kevent(m_kq, nullptr, 0, &event, 1, nullptr); - assert(ret >= 0); - if (ret == 0) { + if (ret == 0 || (ret < 0 && errno == EINTR)) { // Spurious wakeup; just wait again continue; } + assert(ret > 0); // Check which file descriptor had activity: if it's the shutdown // pipe, then someone called -stop; otherwise it's the named pipe