Changed back WaitEvent() and WaitEventTimeout() to use passed-in variable

Signed-off-by: Jacky Boen <aqiank@gmail.com>