コード例 #1
0
        public static int ReleaseSemaphore(WaitableObject waitableObject, int count)
        {
            Debug.Assert(waitableObject != null);
            Debug.Assert(count > 0);

            s_lock.Acquire();
            try
            {
                return(waitableObject.SignalSemaphore(count));
            }
            finally
            {
                s_lock.Release();
            }
        }
コード例 #2
0
        public static int ReleaseSemaphore(WaitableObject waitableObject, int count)
        {
            Debug.Assert(waitableObject != null);
            Debug.Assert(count > 0);

            LockHolder lockHolder = new LockHolder(s_lock);

            try
            {
                return(waitableObject.SignalSemaphore(count, ref lockHolder));
            }
            finally
            {
                lockHolder.Dispose();
            }
        }
コード例 #3
0
        public static int ReleaseSemaphore(IntPtr handle, int count)
        {
            Debug.Assert(count > 0);

            WaitableObject waitableObject = HandleManager.FromHandle(handle);

            s_lock.Acquire();
            try
            {
                return(waitableObject.SignalSemaphore(count));
            }
            finally
            {
                s_lock.Release();
            }
        }