Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- X509Certificate.cs
- ContextDataSourceContextData.cs
- OdbcHandle.cs
- ToolStripStatusLabel.cs
- _ProxyChain.cs
- Point3DValueSerializer.cs
- SqlVisitor.cs
- SharedPersonalizationStateInfo.cs
- UpdateException.cs
- MetadataUtil.cs
- EventLogRecord.cs
- KnownAssemblyEntry.cs
- DataGridViewSelectedCellCollection.cs
- CompoundFileStreamReference.cs
- Evidence.cs
- cookiecollection.cs
- PartitionResolver.cs
- DataGridViewRowsAddedEventArgs.cs
- ContractMapping.cs
- LassoHelper.cs
- LingerOption.cs
- ElapsedEventArgs.cs
- PrincipalPermission.cs
- ScriptBehaviorDescriptor.cs
- InfoCardMetadataExchangeClient.cs
- SafeHandles.cs
- SqlRecordBuffer.cs
- BoundsDrawingContextWalker.cs
- HttpConfigurationContext.cs
- httpserverutility.cs
- DetailsViewDeleteEventArgs.cs
- DictionaryBase.cs
- AspNetRouteServiceHttpHandler.cs
- AmbientProperties.cs
- VirtualizedCellInfoCollection.cs
- XhtmlConformanceSection.cs
- TemplatePagerField.cs
- WorkflowDesignerMessageFilter.cs
- XmlSchemaValidator.cs
- PreloadedPackages.cs
- MaterialGroup.cs
- MenuCommand.cs
- ColorKeyFrameCollection.cs
- SimpleType.cs
- ManipulationBoundaryFeedbackEventArgs.cs
- CharKeyFrameCollection.cs
- TextWriter.cs
- EventRoute.cs
- SerializationInfoEnumerator.cs
- EntryPointNotFoundException.cs
- ZipIOLocalFileBlock.cs
- ThreadExceptionDialog.cs
- BuildResultCache.cs
- PersistChildrenAttribute.cs
- TemplateInstanceAttribute.cs
- EdmComplexTypeAttribute.cs
- EventLogWatcher.cs
- VisualStateManager.cs
- DataGrid.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- TreeNode.cs
- BitmapEffectGroup.cs
- ObjectDataSourceStatusEventArgs.cs
- ExpressionLexer.cs
- Pen.cs
- StructuredProperty.cs
- ModifyActivitiesPropertyDescriptor.cs
- Memoizer.cs
- BasicViewGenerator.cs
- RouteParser.cs
- EntityContainerEmitter.cs
- StructuredTypeEmitter.cs
- ListViewTableCell.cs
- SchemaNamespaceManager.cs
- FileDialog.cs
- SqlRemoveConstantOrderBy.cs
- UrlMappingCollection.cs
- SqlFormatter.cs
- PropertyValueEditor.cs
- Transform.cs
- DetailsViewPageEventArgs.cs
- MultiPageTextView.cs
- DecimalAnimation.cs
- ListItemConverter.cs
- NetworkStream.cs
- ApplySecurityAndSendAsyncResult.cs
- MexHttpBindingElement.cs
- LoadRetryConstantStrategy.cs
- ListViewSortEventArgs.cs
- MemberCollection.cs
- PathFigure.cs
- MenuItem.cs
- DummyDataSource.cs
- ColorTransform.cs
- BufferedOutputAsyncStream.cs
- WebPartEditorOkVerb.cs
- InProcStateClientManager.cs
- PaperSize.cs
- DesignerHierarchicalDataSourceView.cs
- NonSerializedAttribute.cs