1

I want to notify a working thread with a signal - that it should stop waiting events and check some global conditions. I use epoll_pwait on Linux, and I want to do the same on Mac OS.

But kqueue(2) manual says:

EVFILT_SIGNAL ... Only signals sent to the process, not to a particular thread, will trigger the filter.

How to overcome this limitation? Or may be there is another good way to notify sole thread waiting on kevent?

abyss.7
  • 13,882
  • 11
  • 56
  • 100

1 Answers1

1

Universal method for any I/O multiplexing API is:

  1. Open a pipe using pipe() function,
  2. Add its read end to your kevent/epoll/whatever set,
  3. Write something to another end of the pipe to wakeup your event poller.