Wait for events to be triggered.