fixed forking: now uses waitpid instead of wait (the event-handler process may
terminate while suspending, causing wait to terminate); fixed suspending