Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Net / System / Net / _Semaphore.cs / 1 / _Semaphore.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- #pragma warning disable 618 namespace System.Net { using System; using System.Threading; using System.Security.Permissions; // used for Connection Pooling internal sealed class Semaphore : WaitHandle { internal Semaphore(int initialCount, int maxCount) : base() { lock (this) { // Handle = UnsafeNclNativeMethods.CreateSemaphore(IntPtr.Zero, initialCount, maxCount, IntPtr.Zero); } } /* // Consider removing. public Semaphore(int initialCount, int maxCount, string name) : base() { lock (this) { // */ 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 } /* // Consider removing. internal bool ReleaseSemaphore(int releaseCount, out int previousCount) { return UnsafeNclNativeMethods.ReleaseSemaphore(Handle, releaseCount, out previousCount); } */ } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- NameValueCache.cs
- ManualResetEvent.cs
- Style.cs
- MachineSettingsSection.cs
- TypeInfo.cs
- FaultHandlingFilter.cs
- MarshalByValueComponent.cs
- NativeMethods.cs
- LocalFileSettingsProvider.cs
- SessionEndedEventArgs.cs
- TextTreeObjectNode.cs
- DataSet.cs
- RestHandlerFactory.cs
- XmlSerializer.cs
- CodeTypeParameter.cs
- ResourceContainer.cs
- ReverseInheritProperty.cs
- brushes.cs
- SqlDataReaderSmi.cs
- OciEnlistContext.cs
- TraceData.cs
- AdapterUtil.cs
- NamedPipeChannelFactory.cs
- HexParser.cs
- dataprotectionpermissionattribute.cs
- EditorPartCollection.cs
- ThrowOnMultipleAssignment.cs
- AnnotationResourceCollection.cs
- LiteralControl.cs
- RequiredFieldValidator.cs
- HttpModuleCollection.cs
- ProgressBarRenderer.cs
- DbParameterCollection.cs
- TableCellCollection.cs
- HttpPostedFile.cs
- COM2Enum.cs
- WebBrowserDocumentCompletedEventHandler.cs
- TextTrailingWordEllipsis.cs
- XmlMtomReader.cs
- InternalDuplexChannelFactory.cs
- OdbcException.cs
- X509Extension.cs
- WinEventHandler.cs
- FileDetails.cs
- PropertyChangedEventManager.cs
- URL.cs
- LassoSelectionBehavior.cs
- AssemblySettingAttributes.cs
- ProvideValueServiceProvider.cs
- GridItemPattern.cs
- AttributeExtensions.cs
- securitycriticaldataformultiplegetandset.cs
- DataGridViewRowCancelEventArgs.cs
- ChildDocumentBlock.cs
- ZoomPercentageConverter.cs
- HuffmanTree.cs
- counter.cs
- MaterialGroup.cs
- PersonalizableAttribute.cs
- ElementMarkupObject.cs
- DataMember.cs
- ChtmlCommandAdapter.cs
- IgnorePropertiesAttribute.cs
- DataGridColumn.cs
- VisualStyleTypesAndProperties.cs
- SecurityTokenSerializer.cs
- ManagementPath.cs
- ListenUriMode.cs
- DataBoundLiteralControl.cs
- RectAnimationClockResource.cs
- PictureBox.cs
- PrintDocument.cs
- CodeTypeReferenceExpression.cs
- EncoderFallback.cs
- dsa.cs
- ClientConfigPaths.cs
- SizeKeyFrameCollection.cs
- DefaultBinder.cs
- ObjectDataSourceStatusEventArgs.cs
- MessageBox.cs
- OdbcFactory.cs
- DrawingCollection.cs
- Rotation3DAnimationUsingKeyFrames.cs
- TraceSource.cs
- FixedSOMTextRun.cs
- SchemaImporterExtension.cs
- TextBoxLine.cs
- AnimatedTypeHelpers.cs
- TimeSpan.cs
- FormViewDeletedEventArgs.cs
- DataGridViewCheckBoxCell.cs
- XPSSignatureDefinition.cs
- HttpListenerContext.cs
- ServiceHostingEnvironment.cs
- WindowsSecurityToken.cs
- VersionedStreamOwner.cs
- AssemblyCollection.cs
- CheckBoxBaseAdapter.cs
- RegisteredDisposeScript.cs
- LocalFileSettingsProvider.cs