[Mono-dev] System.Threading.Monitor.IsEntered? Will this be implemented?

vbguy81 info at glinos.com
Mon Dec 9 23:50:03 UTC 2013


Hi,
I have a project in .NET 4.5 that utilizes Monitor.IsEntered to check if
there is still a lock on a particular reference. You can lock multiple times
by doing something like the following.

Monitor.Enter(MyLock);
Monitor.Enter(MyLock);
//..Do something..
Monitor.Exit(MyLock);
//there is still a lock.

As a precaution, when an exception is thrown, I'll loop over MyLock with
Monitor.Exit until IsEnter() returns false. In some of my more complicated
Multi-threaded programs the reference and at times these can get locked
twice (Try to avoid this, but it happens).  For me, using Monitor.IsEntered
is an easy way to make sure everything gets cleaned up.

In Thread.cs, I found the following:

#if NET_4_5
    [MonoTODO]
    public static bool IsEntered (object obj)
    {
        throw new NotImplementedException ();
    }
#endif

Does anyone have a timeline when this might be implemented?

Thanks,
Harry



--
View this message in context: http://mono.1490590.n4.nabble.com/System-Threading-Monitor-IsEntered-Will-this-be-implemented-tp4661494.html
Sent from the Mono - Dev mailing list archive at Nabble.com.


More information about the Mono-devel-list mailing list