I need a timer, which won't stop this loop or freeze it, but it will wait, until timer is over and executes code without interfering with the while or for loop
What OS are you using? If you are using Windows, have a look at Waitable Timers
http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx