How to wait for a lock for millisecondsTimeout bigger then MaxInt3

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I wanted to use Monitor.Wait but the millisecondsTimeout parameter is of
type
int, and also with the TimeSpan param it can't be greater than MaxInt32
milliseconds.

What to do ?

Thanks.
 
Hi Yaron,
you must want to wait for a long time, that will give you over 24days of
waiting time :-).

I would recommend that if you want to wait longer you put the call to Wait
inside a loop, the only way to exit the loop is if you acquire the monitor
without timing out (or if the user cancels it), if you do time out the loop
will iterate again calling Monitor.Wait again.

Hope that helps
Mark R Dawson
 
What to do ?

Is that really a problem? You mean you have to wait longer than 25 days?


Mattias
 
If ya really want it to be that loooog, a simple subscription service will do
a little better (say a thread wake up every month, check a flag, send some
msg) IMO
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top