Julie,
Infinite means that it will wait forever to acquire the lock. A timeout
of 0 means that it will try and acquire the lock, and if it can't do it
instantly, it will give you the timed out exception.
You might want to consider using something else than a ReaderWriterLock.
My tests show it is horrendously slow (about 6-7 times) and there are a few
comments in blogs out there indicating that there is a starvation issue with
it. This isn't scheduled to be fixed until .NET 3.0 as well.
My suggestion, use the lock statement. You will get better performance.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
(E-Mail Removed)
"Julie" <(E-Mail Removed)> wrote in message
news:74GRe.7466$ct5.4585@fed1read04...
> According to the documentation for the Acquire methods on the
> ReaderWriterLock class:
>
> -1 Infinite.
> 0 No time-out.
> > 0 The number of milliseconds to wait.
>
> http://msdn.microsoft.com/library/de...classtopic.asp
>
> Does someone want to explain to me the difference between -1 (infinite)
> and 0 (no time-out)???
>
> I've been using 0, but occasionally get a time-expired exception that
> traces back to an attempted acquire ??? I thought 0 was /not/ supposed to
> time out.
>
> I've switched to Timeout.Infinite (-1) to see if that fixes the problem.
> Regardless, I'd like to know the difference(s) between the two values.