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

"Andrés G. Aragoneses" knocte at gmail.com
Wed Dec 11 10:43:33 UTC 2013


Seems very straightforward to implement. If I were you I would just have
a crack at it, and propose it as a pull request. It's the best way to
get unblocked.


On 10/12/13 00:50, vbguy81 wrote:
> 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