Question

I am trying to use Apple's example of using kqueue but the callback is never called unless I start observing the kqueue after the process starts. But the lifetime of the process is short and i need the code to work if the process starts before or after I start observing it.

Was it helpful?

Solution

What if you send the process a SIGSTOP immediately after starting it, and then SIGCONT after setting up the kqueue?

If you're using fork and exec directly, you could have the child send itself SIGSTOP (using raise(3)) and have the parent send it SIGCONT.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top