Tech Tutorials Database
GeekArticles Microsoft C#
 

Locking multiple (up to 2) objects

 
Author: codeproject.com
Category: C#
Comments (0)

This code is buggy.See the line:if (Monitor.TryEnter(po1) && Monitor.TryEnter(po2)) return;Imagine that the lock to po1 is true, but for po2 is false (or vice-versa).It will not return, and later will lock po1 again.So, when unlocking, it will unlock the wrong number of...

Read More...




Sponsored Links




Read Next: Setting a default value for C# Auto-implemented properties



 

 

Comments



Post Your Comment:

Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe