System.Threading.Semaphore.Release C# (CSharp) Méthode

Release() private méthode

private Release ( int releaseCount ) : int
releaseCount int
Résultat int
        public int Release(int releaseCount)
        {
            if (releaseCount < 1)
            {
                throw new ArgumentOutOfRangeException("releaseCount", SR.GetString(SR.ArgumentOutOfRange_NeedNonNegNumRequired));
            }
            int previousCount;

            //If ReleaseSempahore returns false when the specified value would cause
            //   the semaphore's count to exceed the maximum count set when Semaphore was created
            //Non-Zero return 

            if (!SafeNativeMethods.ReleaseSemaphore(SafeWaitHandle, releaseCount, out previousCount))
            {
                throw new SemaphoreFullException();
            }

            return previousCount;
        }

Same methods

Semaphore::Release ( ) : int

Usage Example

Exemple #1
0
        internal void ExitCPUContext(ICPUContext CPUContext)
        {
            System.Diagnostics.Debug.Assert(CPUContext.IsCurrent());

            ((CPUContext)CPUContext).Release();

            // UnlockCPUでは、deleteしたCPUContextに対してEndDelaySuspendを
            // 呼んでしまうので、その手前の処理のみ実行。
            int TlsLockCount = (int)m_TlsIndex.Value;

            TlsLockCount--;

            // ロック解除
            if (TlsLockCount == 0)
            {
                m_SysSem.Release();
                Interlocked.Decrement(ref m_Locked);
            }

            m_TlsIndex.Value = TlsLockCount;

            m_IntEvent.Set();

            CPUContext.Exit();
        }
All Usage Examples Of System.Threading.Semaphore::Release