Opc.Ua.SafeLock.HasLock C# (CSharp) Method

HasLock() public method

Checks if the current thread has acquired the lock.
public HasLock ( ) : bool
return bool
        public bool HasLock()
        {
            int threadId = Thread.CurrentThread.ManagedThreadId;

            int result = Interlocked.CompareExchange(ref m_owner, threadId, threadId);

            if (result != threadId)
            {
                return false;
            }

            return true;
        }