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
- UnsafeNetInfoNativeMethods.cs
- JoinTreeNode.cs
- TextRange.cs
- XmlArrayItemAttributes.cs
- MDIClient.cs
- Root.cs
- RichListBox.cs
- GroupBox.cs
- BasicExpandProvider.cs
- SafeTimerHandle.cs
- FilteredXmlReader.cs
- WSHttpSecurityElement.cs
- DataKeyCollection.cs
- AlternationConverter.cs
- RtType.cs
- NativeCppClassAttribute.cs
- LocalizabilityAttribute.cs
- ExceptionUtil.cs
- DescendantOverDescendantQuery.cs
- IIS7WorkerRequest.cs
- SplitterEvent.cs
- VerificationAttribute.cs
- X509Certificate2Collection.cs
- GridViewColumnHeader.cs
- DockProviderWrapper.cs
- CookielessData.cs
- FuncCompletionCallbackWrapper.cs
- ImageFormatConverter.cs
- BuilderPropertyEntry.cs
- NavigationExpr.cs
- IISUnsafeMethods.cs
- WindowsSecurityToken.cs
- EtwTrace.cs
- DataControlFieldsEditor.cs
- MeshGeometry3D.cs
- NativeWindow.cs
- Bezier.cs
- RectangleGeometry.cs
- VideoDrawing.cs
- SequentialUshortCollection.cs
- Bits.cs
- SqlDataSourceView.cs
- PrtTicket_Base.cs
- PathFigureCollectionConverter.cs
- DesignSurfaceCollection.cs
- BitmapVisualManager.cs
- EnvironmentPermission.cs
- Base64WriteStateInfo.cs
- TextTreeUndoUnit.cs
- TaskExtensions.cs
- LinqDataSourceView.cs
- TransformGroup.cs
- SqlDataSourceConfigureSortForm.cs
- CompilationAssemblyInstallComponent.cs
- assemblycache.cs
- DesignerLoader.cs
- SQLChars.cs
- EndpointInstanceProvider.cs
- NestPullup.cs
- ButtonColumn.cs
- MSHTMLHost.cs
- MemberMemberBinding.cs
- PageParser.cs
- MDIControlStrip.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- FontUnitConverter.cs
- ConnectionsZone.cs
- DynamicResourceExtensionConverter.cs
- CellParagraph.cs
- RegexCharClass.cs
- ImageConverter.cs
- _ProxyChain.cs
- XmlDataSourceView.cs
- ImageField.cs
- DbParameterCollectionHelper.cs
- DelayedRegex.cs
- ScriptingWebServicesSectionGroup.cs
- NavigatorOutput.cs
- DynamicFilterExpression.cs
- WindowsScroll.cs
- MultilineStringConverter.cs
- ObjectContext.cs
- XmlElementElementCollection.cs
- PathSegmentCollection.cs
- WebAdminConfigurationHelper.cs
- VectorAnimationBase.cs
- XPathNode.cs
- httpapplicationstate.cs
- TableColumnCollection.cs
- SqlNotificationRequest.cs
- MessageBuffer.cs
- DetailsViewInsertEventArgs.cs
- Quaternion.cs
- ClickablePoint.cs
- SizeConverter.cs
- QueueException.cs
- MemberAssignment.cs
- hebrewshape.cs
- CollectionChangedEventManager.cs
- Msec.cs