lock Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at 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.

Syntax

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

See Also

lock
lock Members