This is a reimplementation of Libc's `system()`. On Darwin the Libc implementation contains a mutex which prevents it from being used concurrently. This implementation **can** be used concurrently. It sets the signal handlers when the first thread enters and restores them when the last thread finishes execution of the function and ensures this is not racey by using a mutex.