Make the current signal-handling __APPLE__ only. Add a simpler implementation
for __linux__ which uses sigtimedwait() to poll for signals.