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
- ViewSimplifier.cs
- BinaryMethodMessage.cs
- GridSplitterAutomationPeer.cs
- ConsumerConnectionPointCollection.cs
- TailCallAnalyzer.cs
- BinarySecretKeyIdentifierClause.cs
- SemanticResultKey.cs
- MultiBinding.cs
- PropertyRef.cs
- SQLBytes.cs
- ContractTypeNameCollection.cs
- NullRuntimeConfig.cs
- WebPartDisplayModeCancelEventArgs.cs
- ValueTypeFixupInfo.cs
- SqlTrackingService.cs
- NoClickablePointException.cs
- DetailsViewDesigner.cs
- DrawingAttributesDefaultValueFactory.cs
- SessionStateSection.cs
- PropertyConverter.cs
- SiteMapDataSource.cs
- SymbolMethod.cs
- HotSpot.cs
- Point3DCollectionValueSerializer.cs
- ListBoxAutomationPeer.cs
- ReverseInheritProperty.cs
- DispatcherHooks.cs
- GridPatternIdentifiers.cs
- BuildResultCache.cs
- WorkflowTransactionOptions.cs
- DataChangedEventManager.cs
- Function.cs
- BindingListCollectionView.cs
- ObjectListItem.cs
- ConfigXmlAttribute.cs
- AnnotationComponentChooser.cs
- PenThreadWorker.cs
- BinaryWriter.cs
- SchemaDeclBase.cs
- HttpStreamFormatter.cs
- InputScope.cs
- DataServiceQuery.cs
- ContainerAction.cs
- TabPanel.cs
- HostedHttpRequestAsyncResult.cs
- MobileControlsSectionHandler.cs
- TypeResolver.cs
- CodeAttachEventStatement.cs
- InvokeGenerator.cs
- TimeZone.cs
- UserControl.cs
- GregorianCalendarHelper.cs
- NumberFormatInfo.cs
- TriState.cs
- ValidationHelper.cs
- TerminatorSinks.cs
- OperationAbortedException.cs
- IpcServerChannel.cs
- EventLogPropertySelector.cs
- SafeNativeMethods.cs
- DbParameterHelper.cs
- _LocalDataStore.cs
- RoleGroupCollection.cs
- PageAsyncTaskManager.cs
- XmlSerializerVersionAttribute.cs
- PathFigureCollectionValueSerializer.cs
- ReachFixedPageSerializerAsync.cs
- GorillaCodec.cs
- DefaultAssemblyResolver.cs
- SetStateEventArgs.cs
- MessageSmuggler.cs
- XmlAutoDetectWriter.cs
- ObjectDataSourceSelectingEventArgs.cs
- HostingPreferredMapPath.cs
- PeerApplication.cs
- ToolStripMenuItem.cs
- ZoomPercentageConverter.cs
- FormViewAutoFormat.cs
- CodeVariableReferenceExpression.cs
- SpeechRecognitionEngine.cs
- Underline.cs
- EditorBrowsableAttribute.cs
- TextWriterTraceListener.cs
- ProxyWebPartManager.cs
- Label.cs
- TextEndOfLine.cs
- StylusPointCollection.cs
- FtpRequestCacheValidator.cs
- FlatButtonAppearance.cs
- SecurityNegotiationException.cs
- EntityClassGenerator.cs
- EntityDataSourceEntitySetNameItem.cs
- DocumentApplication.cs
- UnmanagedBitmapWrapper.cs
- FreezableOperations.cs
- DataError.cs
- ResourceFallbackManager.cs
- CurrencyManager.cs
- BatchWriter.cs
- StringArrayConverter.cs