Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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); } */ } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// 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); } */ } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Bold.cs
- Psha1DerivedKeyGenerator.cs
- VersionedStreamOwner.cs
- ObjectDisposedException.cs
- ExtentJoinTreeNode.cs
- ContentIterators.cs
- ClientBuildManagerCallback.cs
- XmlIterators.cs
- FontUnitConverter.cs
- relpropertyhelper.cs
- StringAnimationUsingKeyFrames.cs
- GlyphRunDrawing.cs
- QilValidationVisitor.cs
- SoundPlayerAction.cs
- SessionState.cs
- InputGestureCollection.cs
- HtmlInputRadioButton.cs
- KeyNotFoundException.cs
- MD5.cs
- DataBinding.cs
- DataGridViewRowHeaderCell.cs
- JsonStringDataContract.cs
- ProtectedProviderSettings.cs
- DataSourceCacheDurationConverter.cs
- LoginName.cs
- AssociationType.cs
- path.cs
- SlipBehavior.cs
- Floater.cs
- AttachedPropertyMethodSelector.cs
- XsltQilFactory.cs
- SystemEvents.cs
- NullableLongAverageAggregationOperator.cs
- COM2ExtendedBrowsingHandler.cs
- GenericTypeParameterBuilder.cs
- SecurityContextCookieSerializer.cs
- EntityDataSourceReferenceGroup.cs
- InputProcessorProfiles.cs
- ChangeInterceptorAttribute.cs
- UnmanagedBitmapWrapper.cs
- XmlEncodedRawTextWriter.cs
- RtfNavigator.cs
- UriSectionReader.cs
- ListView.cs
- UrlPath.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- XmlQueryContext.cs
- FileCodeGroup.cs
- DataGridViewCellConverter.cs
- ProfileGroupSettings.cs
- DataSetViewSchema.cs
- LogicalExpressionEditor.cs
- TextRange.cs
- OleDbInfoMessageEvent.cs
- LayoutInformation.cs
- HtmlString.cs
- Columns.cs
- BidOverLoads.cs
- RSACryptoServiceProvider.cs
- Matrix3DValueSerializer.cs
- ObjectDataSourceChooseMethodsPanel.cs
- LocationUpdates.cs
- FlowLayout.cs
- MetabaseSettingsIis7.cs
- ServicesUtilities.cs
- RootProjectionNode.cs
- EntityContainerAssociationSetEnd.cs
- Version.cs
- RecognizerBase.cs
- ImageListUtils.cs
- DataGridColumnDropSeparator.cs
- LineServicesCallbacks.cs
- DelegatingConfigHost.cs
- ComboBoxAutomationPeer.cs
- FacetEnabledSchemaElement.cs
- XhtmlConformanceSection.cs
- AppDomainAttributes.cs
- ReferentialConstraintRoleElement.cs
- TextSelection.cs
- AsyncWaitHandle.cs
- SafeHandles.cs
- ConstrainedDataObject.cs
- ValidationHelpers.cs
- ImageField.cs
- ResXBuildProvider.cs
- coordinatorfactory.cs
- HttpCapabilitiesEvaluator.cs
- MarkupExtensionParser.cs
- _WebProxyDataBuilder.cs
- TextEndOfSegment.cs
- XmlCountingReader.cs
- BooleanKeyFrameCollection.cs
- MouseButton.cs
- MethodBuilderInstantiation.cs
- BinaryParser.cs
- RenderOptions.cs
- SoapElementAttribute.cs
- RelationshipDetailsCollection.cs
- connectionpool.cs
- Drawing.cs