Skip to content

Commit

Permalink
Fix compilation on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Simul Piscator authored and Simul Piscator committed Nov 8, 2023
1 parent 3b6d69c commit d31d8ce
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions zeroconf/networkhotplugnotifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ struct NetworkHotplugNotifier::Private
Private(NetworkHotplugNotifier* pNotifier)
: mpNotifier(pNotifier), mPipeWriteFd(-1), mPipeReadFd(-1)
{
#if !__APPLE__
int fds[2];
if (::pipe(fds) < 0) {
std::cerr << "Could not create socket pair " << errno << std::endl;
Expand All @@ -48,15 +49,18 @@ struct NetworkHotplugNotifier::Private
mPipeReadFd = fds[0];
mPipeWriteFd = fds[1];
mThread = std::thread([this]() { hotplugThread(); });
#endif // !__APPLE__
}

~Private()
{
#if !__APPLE__
char c = '0';
::write(mPipeWriteFd, &c, 1);
mThread.join();
::close(mPipeWriteFd);
::close(mPipeReadFd);
#endif // !__APPLE__
}

void hotplugThread()
Expand Down

0 comments on commit d31d8ce

Please sign in to comment.