Ignore SIGINT and SIGQUIT and block SIGCHLD, as POSIX requires.
To deal with the concurrency problem described in POSIX, we keep track
of the count of concurrent invocations. We ignore and block signals
only when the counter was zero before we incremented it, and restore
them only when the counter reaches zero after we decrement it.
Note that this does not address the issue of thread cancellation.