Skip to content
This repository has been archived by the owner on Nov 8, 2021. It is now read-only.

Handle EINTR in the apple version of ExternalCommitHelper #804

Merged
merged 1 commit into from
Jun 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/impl/apple/external_commit_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down