Timeout function decorator