Hello,
Unfortunately, that code above is unfriendly to other processes on the computer, because of the infinite loop that is run. Granted, in this close example, you are looking at 5 seconds, and that won't cause something to croke.
But, if I had to do a delay in the minutes range, that would peg the CPU, and cause a system admin to come and shut you down. That might not matter today, but back in the day when CPU seconds = money on the mainframe, a loop like that could run you out of money.
There has to be a better way without doing the raw iteration!
(I had a program that needed the delay, and I ended up using a part C++ program and part of a BASH shell script so that I could do the wait() command that did not use CPU power during the delay)
Christian
Reputation Points: 121
Solved Threads: 57
Posting Virtuoso
Offline 1,629 posts
since Mar 2004