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
- WinInetCache.cs
- NonSerializedAttribute.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- DesigntimeLicenseContext.cs
- IriParsingElement.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- FunctionGenerator.cs
- StandardRuntimeEnumValidatorAttribute.cs
- HyperLinkColumn.cs
- TypeElement.cs
- ComponentDispatcherThread.cs
- DeobfuscatingStream.cs
- PropagatorResult.cs
- StorageEntitySetMapping.cs
- DoubleAnimationBase.cs
- TextStore.cs
- HwndStylusInputProvider.cs
- EdmComplexPropertyAttribute.cs
- EncoderFallback.cs
- ConfigXmlSignificantWhitespace.cs
- OverlappedAsyncResult.cs
- IncomingWebResponseContext.cs
- ButtonBaseAutomationPeer.cs
- BinaryConverter.cs
- DateTimeFormatInfoScanner.cs
- DataGridPageChangedEventArgs.cs
- TCPListener.cs
- Pkcs7Signer.cs
- SimpleTypeResolver.cs
- ExpressionVisitorHelpers.cs
- ActivityMarkupSerializationProvider.cs
- SynchronizationLockException.cs
- Image.cs
- DocumentPageView.cs
- BitmapEffectDrawingContextWalker.cs
- TabPanel.cs
- x509utils.cs
- StringBuilder.cs
- RecognitionEventArgs.cs
- StoreItemCollection.Loader.cs
- TimeStampChecker.cs
- Tuple.cs
- VisualTarget.cs
- TimeoutException.cs
- Highlights.cs
- PeerNameRegistration.cs
- Roles.cs
- _ListenerResponseStream.cs
- Walker.cs
- PropertyMapper.cs
- SendActivityDesignerTheme.cs
- IncrementalCompileAnalyzer.cs
- StylusOverProperty.cs
- FrameworkRichTextComposition.cs
- SystemKeyConverter.cs
- GeometryCollection.cs
- CodeGenerator.cs
- PageRanges.cs
- Color.cs
- DataGridViewToolTip.cs
- TextProperties.cs
- ScrollProviderWrapper.cs
- TypeConstant.cs
- ExceptionNotification.cs
- ChunkedMemoryStream.cs
- CodeTypeDelegate.cs
- Compiler.cs
- WindowsFormsEditorServiceHelper.cs
- ControlPropertyNameConverter.cs
- InvokeGenerator.cs
- SqlFlattener.cs
- ReadOnlyDataSource.cs
- DocumentPage.cs
- HttpCacheVary.cs
- CodeSnippetCompileUnit.cs
- RegularExpressionValidator.cs
- ListViewGroupItemCollection.cs
- EntityDataSourceMemberPath.cs
- ConstraintManager.cs
- Content.cs
- PeerCollaborationPermission.cs
- HttpRuntimeSection.cs
- NetMsmqBindingCollectionElement.cs
- BoolExpression.cs
- LinqDataSource.cs
- ConfigurationPropertyAttribute.cs
- RowParagraph.cs
- ExternalException.cs
- XmlSchemaParticle.cs
- SimpleRecyclingCache.cs
- Codec.cs
- WebPartMenu.cs
- ConfigXmlComment.cs
- TimelineGroup.cs
- FactorySettingsElement.cs
- DataGridViewCellMouseEventArgs.cs
- StorageTypeMapping.cs
- MemberAccessException.cs
- XmlMapping.cs
- HtmlEncodedRawTextWriter.cs