optimized wakeup and timeout