lock Class
This class automates taking a lock for synchronizing access to an object from multiple threads. When constructed it acquires the lock and when destroyed it releases the lock.
ref class lock;
Remarks
lock is available only for CLR objects and can only be used in CLR code.
Internally, the lock class uses Monitor to synchronize access. See this topic for more detailed information on synchronization.
Requirements
Header file <msclr\lock.h>
Namespace msclr