Well, you are the development branch maintainer, but for me a
code which fails only in 0.00001% of all cases is still incorrect. ;)
However, I also think that your idea to use a flag/counter in the wineserver
cannot really work. Lets assume the following code sequence:
* client starts the wineserver call, and calls pthread_setmask()
* server sends a SIGUSR1, because no outstading system APCs yet
* client writes the request
* server assumes that it is safe to dequeue the system APC now, only further USR1 signals are blocked
* client waits for the reply
* client restores signal mask, and receives the SIGUSR1 during the system APC
To fix that remaining race, you would have to check somehow, if the send SIGUSR1
has already arrived in the meantime. I think it only gets more ugly when going
in this direction. :/