This documentation is archived and is not being maintained.
Monitor::TryEnter Method (Object, Int32)
Visual Studio 2010
Attempts, for the specified number of milliseconds, to acquire an exclusive lock on the specified object.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- obj
- Type: System::Object
The object on which to acquire the lock.
- millisecondsTimeout
- Type: System::Int32
The number of milliseconds to wait for the lock.
| Exception | Condition |
|---|---|
| ArgumentNullException | The obj parameter is nullptr. |
| ArgumentOutOfRangeException | millisecondsTimeout is negative, and not equal to Infinite. |
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show:
Note