Jeremy Feng : add the waiting event function.