Use waitEvent, uses much less CPU