What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 53336 |  Welcome, Guest!   Register  Login
 Home > Interview Questions > C# Interview Questions > What is the use of Monitor in C#? ... ...

What is the use of Monitor in C#?

Interview question and answer by: Raja | Posted on: 4/8/2008 | Category: C# Interview questions | Views: 12277 |


Answer:

It provides a mechanism that synchronizes access to objects.

The Monitor class controls access to objects by granting a lock for an object to a single thread. Object locks provide the ability to restrict access to a block of code, commonly called a critical section. While a thread owns the lock for an object, no other thread can acquire that lock. You can also use Monitor to ensure that no other thread is allowed to access a section of application code being executed by the lock owner, unless the other thread is executing the code using a different locked object.

For more visit http://msdn2.microsoft.com/en-us/library/system.threading.monitor.aspx

Asked In: Microsoft | Alert Moderator 
Found interesting? Add this to:


>> Write Response - Respond to this post and get points

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/22/2013 1:12:13 PM