Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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); } */ } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WebPartRestoreVerb.cs
- GridPattern.cs
- XmlEntityReference.cs
- DataGridViewComponentPropertyGridSite.cs
- DesignerTransaction.cs
- WindowsSecurityTokenAuthenticator.cs
- AuditLogLocation.cs
- DirectoryNotFoundException.cs
- XmlDocument.cs
- ArraySet.cs
- SqlCaseSimplifier.cs
- DictionaryTraceRecord.cs
- ControlBindingsCollection.cs
- TypeConverterAttribute.cs
- AssemblyCache.cs
- FrameworkObject.cs
- TableColumnCollection.cs
- UpdateCommand.cs
- CommandManager.cs
- MethodRental.cs
- PlatformNotSupportedException.cs
- TaiwanLunisolarCalendar.cs
- EntityCommandDefinition.cs
- WindowsTooltip.cs
- XmlReader.cs
- ActionMessageFilter.cs
- ResourcePool.cs
- NullableBoolConverter.cs
- DbConnectionPoolOptions.cs
- XmlSchemaSimpleType.cs
- SslStream.cs
- HandleExceptionArgs.cs
- SpecialNameAttribute.cs
- DataGridTable.cs
- PauseStoryboard.cs
- GridViewRowEventArgs.cs
- DirectionalLight.cs
- RegexBoyerMoore.cs
- LoadedOrUnloadedOperation.cs
- RelationalExpressions.cs
- SupportsEventValidationAttribute.cs
- WebBrowser.cs
- LocatorBase.cs
- Compiler.cs
- PathData.cs
- Grant.cs
- MasterPageBuildProvider.cs
- ConfigXmlSignificantWhitespace.cs
- XmlSchemaRedefine.cs
- ListBoxItemWrapperAutomationPeer.cs
- LinkLabel.cs
- RangeValueProviderWrapper.cs
- ToolboxItemCollection.cs
- securitymgrsite.cs
- httpstaticobjectscollection.cs
- ImageProxy.cs
- CompositeKey.cs
- SrgsToken.cs
- DecoratedNameAttribute.cs
- NavigationFailedEventArgs.cs
- ISFTagAndGuidCache.cs
- FileAuthorizationModule.cs
- LambdaCompiler.Statements.cs
- AdornerHitTestResult.cs
- BlockCollection.cs
- _ConnectStream.cs
- CellIdBoolean.cs
- AvTrace.cs
- FragmentQueryProcessor.cs
- SignatureToken.cs
- ReadOnlyDataSourceView.cs
- TypeValidationEventArgs.cs
- XAMLParseException.cs
- NCryptSafeHandles.cs
- MethodRental.cs
- SiteMapDataSourceView.cs
- parserscommon.cs
- QuadraticBezierSegment.cs
- StatusBarAutomationPeer.cs
- RemotingServices.cs
- configsystem.cs
- InvocationExpression.cs
- ConfigurationManager.cs
- __ComObject.cs
- ValueUtilsSmi.cs
- TextServicesPropertyRanges.cs
- RegexTree.cs
- TransactionValidationBehavior.cs
- LinearQuaternionKeyFrame.cs
- TextBoxView.cs
- ScrollItemPatternIdentifiers.cs
- EpmCustomContentSerializer.cs
- BitmapEffectGeneralTransform.cs
- StrongNameKeyPair.cs
- CookieProtection.cs
- ConfigXmlDocument.cs
- VirtualPathUtility.cs
- SystemWebCachingSectionGroup.cs
- TypeElementCollection.cs
- RadialGradientBrush.cs