> static void AssertIsLocked(object o) {
>         if (Monitor.TryEnter(o))
>                 throw new ProgrammerNegligentException();
> }

The problem with this is that TryEnter will succeed regardless whether
the thread currently owns the lock on o.  It will only fail if *another*
thread owns the lock on o.  We want an exception to be thrown if the
thread does not own a lock on o.

--
Steve Johnson
3t Systems

Reply via email to