How to run a Thread for a specific amount of time.