Suppose the following scenario:
- First call of daemon: it finds 5 new messages on the server and plays the "you have mail"-sound.
- You go to your "Outlook"-box and download these mails and switch off Outlook.
- 2 new mails arrive before daemon gets called again.
- daemon gets called again and finds 2 messages on the server which is less than the 5 messages it has in $precnt, so the sound does not get played and you miss these messages which required you to answer within 2 minutes to claim your 1,000,000 $ prize in the Internet Sweepstake!
I think it is called a
race condition.
One other remark: would it be easier on the computer resources to have daemon run by a cron-type job rather than keep it running and sleeping? Probably depend on how quickly it has to run again.
One final comment: some ISP's don't like it that their mail-servers get polled at a too high rate (several times every few minutes). I once got cut-off for 10 minutes by just doing that.
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law