Move wait to a look

Putting the thread to sleep with wait no longer allows signals to be captured (PHP 5 >= 5.3.0). This allow signals like USR1 to be used again.

http://www.php.net/manual/en/function.pcntl-signal.php#114575
http://www.php.net/manual/en/function.pcntl-signal-dispatch.php