Provides a mechanism that synchronizes access to objects. It is implemented as a thin wrapper on Monitor. During testing, the implementation is automatically replaced with a controlled mocked version. It can be used as a replacement of the lock keyword to allow systematic testing.
public class SynchronizedBlock : IDisposable
||Creates a new
SynchronizedBlock for synchronizing access to the specified object and enters the lock.
||Releases resources used by the synchronized block.
||Notifies a thread in the waiting queue of a change in the locked object’s state.
||Notifies all waiting threads of a change in the object’s state.
||Releases the lock on an object and blocks the current thread until it reacquires the lock.
||Releases the lock on an object and blocks the current thread until it reacquires the lock. If the specified time-out interval elapses, the thread enters the ready queue. (2 methods)