5

I would write a small test that shows me the difference between epoll_Wait and epoll_pwait() by catching any interrupted signal. can anyone provide me by a small code or any method to find that?

int epoll_pwait(int epfd, struct epoll_event *events,
                  int maxevents, int timeout,
                  const sigset_t *sigmask);
Denys Séguret
  • 372,613
  • 87
  • 782
  • 758
Hatem Mashaqi
  • 610
  • 1
  • 7
  • 18

2 Answers2

3

If you are looking for a way to integrate signal handling in an epoll event loop, have a look at the signalfd(2) man page.

It will give you an fd which you can add to your pollset to be notified when your process (or thread, if that is relevant in your case) has received a signal.

wkz
  • 2,203
  • 1
  • 15
  • 21
1

epoll_pwait does not "catch signals", it allows you to atomically set a new process signal mask which is only active during the call. See the description on the man page, e.g. http://linux.die.net/man/2/epoll_wait

What is it you are trying to achieve? if you are more specific, I might be able to give you more information.

Dan
  • 43
  • 5