August 2003
Beginner to intermediate
600 pages
12h 57m
English
The Monitor class provides another synchronization mechanism available in the .NET Compact Framework. The Monitor class is useful for protecting access to specific objects. You can use a Monitor to make sure that only one thread accesses a specific object at a time. This intent is subtly different from using a Mutex, which you can use to prevent two threads from executing a specific block of code at one time.
To use a Monitor to prevent multiple threads from accessing the same object, follow these steps:
1. | Acquire the object that you want to protect. When you want to access the protected object, first call System.Threading.Monitor.Enter(). Pass in the reference to the object to protect. ... |
Read now
Unlock full access