How to set sigmask and do a long jump atomically in my signal handler?

38 views Asked by At

I am implementing a coroutine scheduler. A thread is interrupted(by SIGURG) regularly to make a switch. I am using swapcontext(from ucontext.h) in sighandler to achieve that. But I found swapcontext doesn't atomically set sigmask and do a long jump. Instead it firstly call sigprocmask and then do a jmp(which I think may cause trouble like signal handler reentry). How can I avoid this?

0

There are 0 answers