Scott Lackey

Scott Lackey

  • NA
  • 9
  • 8.4k

Thread.Sleep issue

Oct 28 2010 9:46 AM

Hello All
I'm having trouble with a Thread.Sleep issue, as I'm purposley trying to cause a 5 minute delay in a service oriented application I'm supporting.  When monitoring for a specific exception, I'm using a Thread.Sleep(300000) statement.  300,000 milliseconds = 5 minutes, right?  Trouble is, the delays encountered are never 5 minutes, always less, and they vary, sometimes 30 seconds, sometimes 40 seconds, sometimes a full minute.  Anybody have any idea why?
Note:  I have my Thread.Sleep(300000) in a catch block where I'm monitoring for IOException, specifically a semaphore timeout period.  Would this type of exception cause the thread.sleep to behave sporadically as I described above?  The five minute delays seem to work consistently in other areas of the application.
Any insights?  Would be appreaciated!
Thanks!

Answers (5)