System.Net.Semaphore.ReleaseSemaphore C# (CSharp) Метод

ReleaseSemaphore() приватный Метод

private ReleaseSemaphore ( ) : bool
Результат bool
        internal bool ReleaseSemaphore() {
#if DEBUG        
            int previousCount;
            bool success = UnsafeNclNativeMethods.ReleaseSemaphore(Handle, 1, out previousCount);        
            GlobalLog.Print("ReleaseSemaphore#"+ValidationHelper.HashString(this)+" success:"+success+" previousCount:"+previousCount.ToString());
            return success;
#else            
            return UnsafeNclNativeMethods.ReleaseSemaphore(Handle, 1, IntPtr.Zero);
#endif            
        }

Usage Example

        /// <devdoc>
        ///    <para>Places a new/reusable stream in the new stack of the pool</para>
        /// </devdoc>
        private void PutNew(PooledStream pooledStream)
        {
            GlobalLog.Enter("ConnectionPool#" + ValidationHelper.HashString(this) + "::PutNew", "#" + ValidationHelper.HashString(pooledStream));

            GlobalLog.Assert(null != pooledStream, "Why are we adding a null object to the pool?");
            GlobalLog.Assert(pooledStream.CanBePooled, "Non-poolable object in pool.");

            m_StackNew.Push(pooledStream);
            Semaphore.ReleaseSemaphore();
            GlobalLog.Leave("ConnectionPool#" + ValidationHelper.HashString(this) + "::PutNew");
        }
All Usage Examples Of System.Net.Semaphore::ReleaseSemaphore