Answer: Lock Vs Monitor in C# multithreading: Difference between monitor and lock in C# is that lock internally wraps the Enter and Exit methods in a try…finally block with exception handling. Whereas for Monitor class in C#, we use try and finally block explicitly to release lock properly. Lock = Monitor + try finally. Below […]
What is C# monitor class? Explain monitor pulse wait by example
Answer includes C# monitor class with program example in threaded program and its pulse wait method. Monitor class in C# multi-threaded program is used to synchronize the shared resources i.e. file IO, shared data and memory etc. among threads. Monitor class is available in namespace System.Threading. Besides synchronization mechanism, Monitor class also provides wait (), […]