コード例 #1
0
ファイル: Tensor.cs プロジェクト: redknightlois/cudalearn
        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
ファイル: Tensor.cs プロジェクト: redknightlois/cudalearn
        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
ファイル: Tensor.cs プロジェクト: redknightlois/cudalearn
        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
ファイル: Tensor.cs プロジェクト: redknightlois/cudalearn
        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;
            }
        }