Rename 'wait' to 'waitEvent' to not confuse with OSX /MacOSX10.8.sdk/usr/include/sys/wait.h function wait().