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
- Point3DConverter.cs
- SqlEnums.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- RuntimeArgumentHandle.cs
- wgx_exports.cs
- AuthenticateEventArgs.cs
- OracleConnectionFactory.cs
- ActivityDesignerLayoutSerializers.cs
- InputEventArgs.cs
- SignatureGenerator.cs
- DependencyObjectProvider.cs
- ModelItemDictionaryImpl.cs
- FrameworkElement.cs
- HyperLinkColumn.cs
- NameValuePair.cs
- XmlDataSourceView.cs
- DateTimeOffsetAdapter.cs
- NavigationExpr.cs
- _BufferOffsetSize.cs
- CacheHelper.cs
- SpeakInfo.cs
- PropertyInformationCollection.cs
- RuntimeHelpers.cs
- GlyphRunDrawing.cs
- XmlTextAttribute.cs
- BamlWriter.cs
- ConnectionConsumerAttribute.cs
- Funcletizer.cs
- PrivilegeNotHeldException.cs
- ScrollPattern.cs
- TriState.cs
- ComboBoxItem.cs
- CapacityStreamGeometryContext.cs
- Missing.cs
- SortFieldComparer.cs
- Currency.cs
- DataControlPagerLinkButton.cs
- FlowLayoutPanelDesigner.cs
- IncomingWebRequestContext.cs
- CompilerError.cs
- TextProperties.cs
- BindingsCollection.cs
- DirectoryGroupQuery.cs
- EntityViewGenerationConstants.cs
- EventItfInfo.cs
- OutputWindow.cs
- KernelTypeValidation.cs
- DecoratedNameAttribute.cs
- QilPatternFactory.cs
- SqlColumnizer.cs
- DataError.cs
- UnsafeNativeMethods.cs
- OdbcTransaction.cs
- WebPartEditorApplyVerb.cs
- CustomAttributeFormatException.cs
- XmlDocumentSerializer.cs
- ExceptionUtil.cs
- BaseHashHelper.cs
- CodeIndexerExpression.cs
- GPPOINTF.cs
- EntityStoreSchemaFilterEntry.cs
- ApplyTemplatesAction.cs
- PathSegment.cs
- ServicePointManager.cs
- CompatibleComparer.cs
- MarkupProperty.cs
- CaseExpr.cs
- RegistryKey.cs
- InvalidCommandTreeException.cs
- MD5.cs
- FloaterParaClient.cs
- TreeNodeConverter.cs
- RecognizerBase.cs
- CodeNamespace.cs
- selecteditemcollection.cs
- CursorEditor.cs
- X509ServiceCertificateAuthentication.cs
- MatrixCamera.cs
- OleDbTransaction.cs
- AssemblyName.cs
- DataGridParentRows.cs
- CodePrimitiveExpression.cs
- EntityConnectionStringBuilder.cs
- BypassElementCollection.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- VectorCollectionConverter.cs
- PerformanceCounterManager.cs
- MemberNameValidator.cs
- OpenFileDialog.cs
- CounterSet.cs
- XPathParser.cs
- EdmSchemaError.cs
- RenderTargetBitmap.cs
- versioninfo.cs
- UndoManager.cs
- LiteralControl.cs
- DefaultValueConverter.cs
- DesignerLoader.cs
- SettingsPropertyNotFoundException.cs
- FormViewDeletedEventArgs.cs