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
- HttpFileCollection.cs
- DropDownButton.cs
- SafeCertificateContext.cs
- DataGridViewCellConverter.cs
- TextProperties.cs
- SBCSCodePageEncoding.cs
- SimpleWebHandlerParser.cs
- APCustomTypeDescriptor.cs
- CodeGotoStatement.cs
- PopupRootAutomationPeer.cs
- DesignerVerb.cs
- Suspend.cs
- WebPartDescription.cs
- ShapingEngine.cs
- StackSpiller.Generated.cs
- ConnectionStringSettingsCollection.cs
- NonBatchDirectoryCompiler.cs
- KnownBoxes.cs
- SecureEnvironment.cs
- DesignerView.Commands.cs
- Panel.cs
- FixedTextSelectionProcessor.cs
- DispatcherHookEventArgs.cs
- TextRangeBase.cs
- XmlSchemaAttribute.cs
- SBCSCodePageEncoding.cs
- LocationInfo.cs
- WindowsRichEditRange.cs
- IndexerNameAttribute.cs
- SerialPinChanges.cs
- ExpressionBuilderContext.cs
- DataObjectSettingDataEventArgs.cs
- ToolboxComponentsCreatedEventArgs.cs
- ExtractedStateEntry.cs
- oledbmetadatacollectionnames.cs
- NumericUpDown.cs
- GrammarBuilderBase.cs
- ColorContext.cs
- AssemblyBuilderData.cs
- TableLayoutSettings.cs
- PropertyReferenceSerializer.cs
- FormViewInsertedEventArgs.cs
- StorageEntitySetMapping.cs
- XmlSchemaParticle.cs
- ButtonFieldBase.cs
- CollectionBase.cs
- ToolStripHighContrastRenderer.cs
- HttpHandlerActionCollection.cs
- TextBoxBase.cs
- FlowDocumentPaginator.cs
- SqlException.cs
- TextElementCollectionHelper.cs
- ToolBarPanel.cs
- NullableBoolConverter.cs
- PropertyDescriptor.cs
- RoutedPropertyChangedEventArgs.cs
- ConfigurationManagerInternal.cs
- LinearKeyFrames.cs
- CharKeyFrameCollection.cs
- HtmlInputPassword.cs
- ScrollItemPatternIdentifiers.cs
- EnumUnknown.cs
- CodeNamespaceImportCollection.cs
- VersionedStreamOwner.cs
- BamlLocalizabilityResolver.cs
- DaylightTime.cs
- XmlCollation.cs
- EnvelopedPkcs7.cs
- ExpandoClass.cs
- HtmlPhoneCallAdapter.cs
- IsolatedStorageFile.cs
- formatter.cs
- ReturnEventArgs.cs
- TextAdaptor.cs
- VScrollBar.cs
- List.cs
- SchemaCollectionCompiler.cs
- PeerCollaborationPermission.cs
- TableSectionStyle.cs
- WorkflowServiceBehavior.cs
- MarkupCompilePass2.cs
- ClrPerspective.cs
- GPRECTF.cs
- ObjectItemCachedAssemblyLoader.cs
- SmtpTransport.cs
- ValueType.cs
- X509Chain.cs
- EditorPartChrome.cs
- JulianCalendar.cs
- XLinq.cs
- TaskFileService.cs
- MarginsConverter.cs
- ReferencedType.cs
- TextRunTypographyProperties.cs
- LoginAutoFormat.cs
- ArrayElementGridEntry.cs
- ToolStripRenderer.cs
- ProfileSection.cs
- NoPersistHandle.cs
- ActionItem.cs