Use of mointer in C#
How to use Monitor in C#.
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Jul 26, 2012, 1:44 AM EDT
http://msdn.microsoft.com/en-us/library/system.threading.monitor.aspx
Niravkumar Vaghela38 reputationPosted Jul 26, 2012, 2:25 AM EDT
In thread synchronization, we need to manage threds action to get expacted output. Synchronization plays important role when two threads access same data.
Monitor objects expose the ability to synchronize access to a region of code by taking and releasing a lock on a particular object using the Monitor.Enter, Monitor.TryEnter, and Monitor.Exit methods. Once you have a lock on a code region, you can use the Monitor.Wait, Monitor.Pulse, and Monitor.PulseAll methods. Wait releases the lock if it is held and waits to be notified. When Wait is notified, it returns and obtains the lock again. Both Pulse and PulseAll signal for the next thread in the wait queue to proceed.
Please refre following link:
http://msdn.microsoft.com/en-us/library/hf5de04k.aspx
Hope this will help you.