Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- ResponseStream.cs
- JapaneseCalendar.cs
- CommonDialog.cs
- DiscoveryExceptionDictionary.cs
- EtwTrace.cs
- HostVisual.cs
- QueueProcessor.cs
- TickBar.cs
- Sentence.cs
- DataRowExtensions.cs
- NameObjectCollectionBase.cs
- basecomparevalidator.cs
- TypeToArgumentTypeConverter.cs
- ApplicationHost.cs
- XmlSchemas.cs
- DynamicDocumentPaginator.cs
- ObjectListComponentEditor.cs
- SystemIPAddressInformation.cs
- Memoizer.cs
- WebPartZoneCollection.cs
- PassportAuthenticationModule.cs
- FontStyles.cs
- OrthographicCamera.cs
- ConfigsHelper.cs
- SyndicationContent.cs
- SocketElement.cs
- TransportReplyChannelAcceptor.cs
- XmlNullResolver.cs
- Parameter.cs
- AncestorChangedEventArgs.cs
- VirtualizedItemPattern.cs
- EnumerableValidator.cs
- ButtonDesigner.cs
- ColumnTypeConverter.cs
- DynamicQueryStringParameter.cs
- DictionarySectionHandler.cs
- WebPartHelpVerb.cs
- Slider.cs
- ICspAsymmetricAlgorithm.cs
- XsltQilFactory.cs
- ControlPersister.cs
- SignedXmlDebugLog.cs
- DataGridBoolColumn.cs
- InputScopeNameConverter.cs
- StateDesigner.Helpers.cs
- CodeTypeReferenceCollection.cs
- Accessors.cs
- FrameSecurityDescriptor.cs
- InternalCache.cs
- ArgIterator.cs
- BStrWrapper.cs
- PersonalizationState.cs
- ScriptingRoleServiceSection.cs
- InternalSafeNativeMethods.cs
- WebPartPersonalization.cs
- DataTableTypeConverter.cs
- DesignerWithHeader.cs
- MessageBox.cs
- InstanceDataCollection.cs
- CompilationPass2TaskInternal.cs
- ListViewCancelEventArgs.cs
- IResourceProvider.cs
- RootAction.cs
- PersistenceMetadataNamespace.cs
- arabicshape.cs
- PasswordBoxAutomationPeer.cs
- DeferredTextReference.cs
- MembershipSection.cs
- FlowLayout.cs
- ListSourceHelper.cs
- XamlVector3DCollectionSerializer.cs
- KeyValuePairs.cs
- QueryCursorEventArgs.cs
- odbcmetadatacollectionnames.cs
- SqlCommand.cs
- RoleManagerModule.cs
- ExpandSegmentCollection.cs
- Error.cs
- Soap.cs
- ExpandCollapsePattern.cs
- ListenerElementsCollection.cs
- HyperLinkStyle.cs
- StrokeCollection.cs
- FigureHelper.cs
- EntityProviderServices.cs
- MessageBox.cs
- ConfigurationSectionGroup.cs
- NullableFloatAverageAggregationOperator.cs
- SqlUDTStorage.cs
- IDictionary.cs
- SHA256CryptoServiceProvider.cs
- PenContexts.cs
- ComponentEditorForm.cs
- XmlSerializerFaultFormatter.cs
- _CommandStream.cs
- OracleDateTime.cs
- securitycriticaldataformultiplegetandset.cs
- SourceElementsCollection.cs
- log.cs
- EmptyReadOnlyDictionaryInternal.cs