Queue with timeout function