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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RecordBuilder.cs
- BaseTreeIterator.cs
- EdmComplexTypeAttribute.cs
- ExpressionVisitor.cs
- MenuAdapter.cs
- ControlBindingsCollection.cs
- BooleanSwitch.cs
- KeyboardNavigation.cs
- TextRunCache.cs
- Popup.cs
- XmlSchemaElement.cs
- ClientRoleProvider.cs
- PasswordTextNavigator.cs
- PerformanceCounterManager.cs
- CaseInsensitiveComparer.cs
- Int16Storage.cs
- X509ServiceCertificateAuthentication.cs
- HTMLTextWriter.cs
- WebPartDisplayMode.cs
- ProviderUtil.cs
- LinkTarget.cs
- ScrollBarAutomationPeer.cs
- ListViewTableRow.cs
- ExpressionPrefixAttribute.cs
- TTSEngineTypes.cs
- Button.cs
- Message.cs
- SiteMapNodeCollection.cs
- GridViewDeleteEventArgs.cs
- IApplicationTrustManager.cs
- TreeNodeStyleCollection.cs
- TaskFactory.cs
- UnsafeNativeMethods.cs
- ApplyImportsAction.cs
- GeneralTransform3D.cs
- AssemblyInfo.cs
- MessageContractAttribute.cs
- SegmentInfo.cs
- AnyReturnReader.cs
- RijndaelCryptoServiceProvider.cs
- SynchronizedInputProviderWrapper.cs
- CriticalExceptions.cs
- CornerRadiusConverter.cs
- URLString.cs
- NameGenerator.cs
- FieldToken.cs
- SafeRegistryKey.cs
- CopyOfAction.cs
- RichTextBox.cs
- FrameworkContentElement.cs
- CollectionDataContract.cs
- KeyPressEvent.cs
- CookieHandler.cs
- DataContractSerializer.cs
- TypeElementCollection.cs
- LeaseManager.cs
- ScriptResourceAttribute.cs
- MediaPlayer.cs
- EntityCommand.cs
- Typeface.cs
- AttributeCollection.cs
- RepeaterItemEventArgs.cs
- ColorAnimationBase.cs
- SwitchDesigner.xaml.cs
- ViewStateModeByIdAttribute.cs
- BitmapDownload.cs
- HttpCapabilitiesEvaluator.cs
- GradientStop.cs
- DockPanel.cs
- ListenerElementsCollection.cs
- VerticalAlignConverter.cs
- HttpPostedFileBase.cs
- State.cs
- SqlDataSourceConfigureSortForm.cs
- GradientStop.cs
- DiscoveryVersion.cs
- SpotLight.cs
- CustomErrorCollection.cs
- NamespaceMapping.cs
- ObjectPersistData.cs
- ToolStripKeyboardHandlingService.cs
- XmlAttributeOverrides.cs
- SystemIPv4InterfaceProperties.cs
- PeerObject.cs
- Array.cs
- ApplicationManager.cs
- RoutedUICommand.cs
- CompositeControl.cs
- TypeUsage.cs
- AttachedAnnotationChangedEventArgs.cs
- BooleanProjectedSlot.cs
- AnnotationHighlightLayer.cs
- PlatformCulture.cs
- RequiredArgumentAttribute.cs
- XmlDataFileEditor.cs
- XpsFilter.cs
- MetadataHelper.cs
- TreeViewEvent.cs
- XmlElementList.cs
- WebConfigurationManager.cs