In a multi-threaded environment, resources are shared between multiple threads. So, it is critical that such resources should be capable of handling access by multiple threads. In this recipe, we will see how to create a shared resource that provides an in-built functionality that handles access by multiple threads using lock and monitors. .NET provides an implementation of monitor for threading in the form of Monitor class. In this recipe, we will see how to use the
Monitor class to create a
intand name ...