Add a sleep in thread main loop