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
- AttachedPropertyBrowsableForChildrenAttribute.cs
- ExpressionEditorAttribute.cs
- Queue.cs
- ComplexObject.cs
- ManipulationDevice.cs
- ProxyWebPartConnectionCollection.cs
- TypeUtils.cs
- DispatchChannelSink.cs
- OdbcConnectionPoolProviderInfo.cs
- DataPagerFieldCollection.cs
- ImpersonateTokenRef.cs
- LocatorPartList.cs
- Helpers.cs
- Random.cs
- SynchronizedInputHelper.cs
- ProtocolViolationException.cs
- MailWriter.cs
- RequestNavigateEventArgs.cs
- NameObjectCollectionBase.cs
- DoubleLinkListEnumerator.cs
- Attributes.cs
- Message.cs
- AuthenticationConfig.cs
- XamlTemplateSerializer.cs
- OleDbException.cs
- WebBrowserNavigatingEventHandler.cs
- DeferredReference.cs
- FilteredSchemaElementLookUpTable.cs
- CommonGetThemePartSize.cs
- SqlDataSourceFilteringEventArgs.cs
- GridViewRowPresenter.cs
- OleAutBinder.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- DataGridViewLinkColumn.cs
- CustomSignedXml.cs
- RIPEMD160Managed.cs
- _AutoWebProxyScriptEngine.cs
- ClassHandlersStore.cs
- BitmapSizeOptions.cs
- CompositeDesignerAccessibleObject.cs
- BindingEditor.xaml.cs
- BamlLocalizabilityResolver.cs
- FileUpload.cs
- PersonalizationState.cs
- StrongNameKeyPair.cs
- SystemInformation.cs
- XmlDocumentSerializer.cs
- OleDbConnectionFactory.cs
- IdleTimeoutMonitor.cs
- MergeExecutor.cs
- StringReader.cs
- ParameterToken.cs
- TopClause.cs
- PathSegment.cs
- PageCatalogPart.cs
- PageContent.cs
- IteratorDescriptor.cs
- StreamBodyWriter.cs
- FrameworkElement.cs
- CompareInfo.cs
- ProcessHostServerConfig.cs
- Debug.cs
- LinqMaximalSubtreeNominator.cs
- StringPropertyBuilder.cs
- PopupEventArgs.cs
- DataRecord.cs
- TimelineCollection.cs
- SessionParameter.cs
- SystemIcmpV6Statistics.cs
- SyntaxCheck.cs
- httpapplicationstate.cs
- ByteStorage.cs
- XmlQueryStaticData.cs
- AlphaSortedEnumConverter.cs
- MessageAction.cs
- DelegateSerializationHolder.cs
- DrawingContextWalker.cs
- TimeSpanMinutesConverter.cs
- WeakEventTable.cs
- QilGeneratorEnv.cs
- DataGridViewCell.cs
- TypeForwardedToAttribute.cs
- QuaternionKeyFrameCollection.cs
- NetSectionGroup.cs
- SuppressMessageAttribute.cs
- SetterBaseCollection.cs
- SqlInternalConnection.cs
- SafeWaitHandle.cs
- LabelEditEvent.cs
- DataGridViewIntLinkedList.cs
- TrustLevel.cs
- SerializationObjectManager.cs
- ToolStripSplitButton.cs
- DocumentAutomationPeer.cs
- XmlSchemaValidator.cs
- CustomAttributeBuilder.cs
- SystemKeyConverter.cs
- UriTemplateEquivalenceComparer.cs
- MessageBodyMemberAttribute.cs
- PeerNameRegistration.cs