Wait for event instead of polling