The minimal change I propose below is as follows:
When we send kill(SIGSTOP) to all the threads, we now include
the event thread, where previously we had made him a special case.
That way, whether in the new model or the old one, we can now do
a waitpid on every thread including the event thread.
What do you think?
To be honest, I don't like this very much. You're hurting performance
in the current case (whose performance is already quite bad enough,
thank you!). I don't think that the additional complexity/waiting is
worthwhile.
Just an aside,