Monitors : Monitor is one of gated synchronization mechanism which consist of two methods which guarantees thread safe behavior.
1.Monitor.Enter : Threads that enter critical section informs other threads that it had acquired the resource/CS and no more threads can take ownership on the same and other threads requiring the resource/CS must wait.
2.Monitor.Exit :The thread which had acquired resource/CS releases the ownership on thread.
In C#,Monitors equivalent code is lock.
lock(object) { //CS } //It is equivalent to Monitor.Enter and Monitor.Exit. try { Monitor.Enter(object) { //CS } } Finally() { Monitor.Exit(object) }