SpinLock.TryEnter Method (Int32, Boolean%)
Attempts to acquire the lock in a reliable manner, such that even if an exception occurs within the method call, lockTaken can be examined reliably to determine whether the lock was acquired.
Assembly: mscorlib (in mscorlib.dll)
millisecondsTimeout is a negative number other than -1, which represents an infinite time-out.
The lockTaken argument must be initialized to false prior to calling TryEnter.
Thread ownership tracking is enabled, and the current thread has already acquired this lock.
Unlike Enter, TryEnter will not block indefinitely waiting for the lock to be available. It will block until either the lock is available or until the millisecondsTimeout has expired.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, 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.