Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- XmlDataSourceNodeDescriptor.cs
- XmlUnspecifiedAttribute.cs
- XamlToRtfParser.cs
- XPathExpr.cs
- ViewStateChangedEventArgs.cs
- Stylesheet.cs
- GridViewRowCollection.cs
- EventlogProvider.cs
- MaskInputRejectedEventArgs.cs
- ProxyWebPartConnectionCollection.cs
- DataGridHelper.cs
- HtmlPhoneCallAdapter.cs
- ObjectCacheSettings.cs
- TextAdaptor.cs
- CfgParser.cs
- Rect3D.cs
- DiscoveryClient.cs
- SamlAuthenticationStatement.cs
- Vector3D.cs
- GenerateDerivedKeyRequest.cs
- CDSCollectionETWBCLProvider.cs
- StatusBarPanelClickEvent.cs
- DataTemplate.cs
- BuildProviderAppliesToAttribute.cs
- FusionWrap.cs
- CryptoHelper.cs
- CodeDirectionExpression.cs
- GridViewEditEventArgs.cs
- CriticalExceptions.cs
- VisualBrush.cs
- AstTree.cs
- ResourcePool.cs
- StoreAnnotationsMap.cs
- CategoryGridEntry.cs
- MenuItem.cs
- DefaultCommandConverter.cs
- NumberSubstitution.cs
- DataSourceView.cs
- HMAC.cs
- EFTableProvider.cs
- ListViewContainer.cs
- XhtmlBasicPageAdapter.cs
- Icon.cs
- WeakReference.cs
- RemoteWebConfigurationHostServer.cs
- SafeBitVector32.cs
- HttpsChannelFactory.cs
- COMException.cs
- EditorZoneBase.cs
- DataControlButton.cs
- DLinqTableProvider.cs
- FunctionCommandText.cs
- CodeDOMProvider.cs
- EntityDataSourceDataSelection.cs
- SqlDataAdapter.cs
- ProcessModelInfo.cs
- MaterialGroup.cs
- MobileListItemCollection.cs
- ListViewPagedDataSource.cs
- DiffuseMaterial.cs
- PageBreakRecord.cs
- TrackingStringDictionary.cs
- WebBrowserUriTypeConverter.cs
- UserPreferenceChangedEventArgs.cs
- DropShadowEffect.cs
- EntityConnectionStringBuilder.cs
- DynamicResourceExtension.cs
- Matrix3DConverter.cs
- DependencyPropertyConverter.cs
- RadioButton.cs
- ContractAdapter.cs
- DataGridViewCellParsingEventArgs.cs
- UnknownWrapper.cs
- InfoCardRSAPKCS1KeyExchangeFormatter.cs
- AppDomainProtocolHandler.cs
- Type.cs
- ApplicationCommands.cs
- Reference.cs
- _WinHttpWebProxyDataBuilder.cs
- SecurityCriticalDataForSet.cs
- DuplexSecurityProtocolFactory.cs
- BrowserDefinitionCollection.cs
- BindingNavigator.cs
- Item.cs
- SafeThreadHandle.cs
- DoubleCollection.cs
- SelectionPatternIdentifiers.cs
- MemberExpression.cs
- ImmutableCollection.cs
- AsyncCompletedEventArgs.cs
- XMLUtil.cs
- ResumeStoryboard.cs
- OpenFileDialog.cs
- Tokenizer.cs
- DetailsViewRowCollection.cs
- InstanceDataCollection.cs
- XmlNodeChangedEventArgs.cs
- FileIOPermission.cs
- AuthenticationModulesSection.cs
- EntityRecordInfo.cs