Removed loop from Thread function and instead make it to call PrintMsgNTimes funciton