示例#1
0
        internal void Lock(TensorLocation location)
        {
            lock (syncRoot)
            {
                if (activeScopeLocation != location && activeScopeCount != 0)
                {
                    throw new InvalidOperationException("Cannot request a tensor lock. There is already an scope active with a different location.");
                }

                Interlocked.Increment(ref activeScopeCount);
                activeScopeLocation = location;
            }
        }
示例#2
0
        internal void Unlock(TensorLocation location)
        {
            lock (syncRoot)
            {
                if (activeScopeLocation != location)
                {
                    throw new InvalidOperationException("Cannot request a tensor unlock on a different location.");
                }

                if (activeScopeCount == 0)
                {
                    throw new InvalidOperationException("Cannot request a tensor unlock. There is no scope active to support the request.");
                }

                Interlocked.Decrement(ref activeScopeCount);
                activeScopeLocation = location;
            }
        }
示例#3
0
        internal void Unlock(TensorLocation location)
        {
            lock (syncRoot)
            {
                if (activeScopeLocation != location)
                    throw new InvalidOperationException("Cannot request a tensor unlock on a different location.");

                if (activeScopeCount == 0)
                    throw new InvalidOperationException("Cannot request a tensor unlock. There is no scope active to support the request.");

                Interlocked.Decrement(ref activeScopeCount);
                activeScopeLocation = location;
            }
        }
示例#4
0
        internal void Lock(TensorLocation location)
        {
            lock (syncRoot)
            {
                if (activeScopeLocation != location && activeScopeCount != 0)
                    throw new InvalidOperationException("Cannot request a tensor lock. There is already an scope active with a different location.");

                Interlocked.Increment(ref activeScopeCount);
                activeScopeLocation = location;
            }
        }