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
- TokenBasedSet.cs
- EmptyEnumerable.cs
- SiteMap.cs
- AssemblyInfo.cs
- SqlBulkCopyColumnMappingCollection.cs
- KoreanLunisolarCalendar.cs
- RadioButtonList.cs
- ConvertTextFrag.cs
- OperandQuery.cs
- SqlUserDefinedAggregateAttribute.cs
- DbConnectionPool.cs
- DispatchProxy.cs
- ProcessStartInfo.cs
- EdmConstants.cs
- SqlMethodCallConverter.cs
- RequestQueue.cs
- BrowserCapabilitiesFactory.cs
- GenericXmlSecurityToken.cs
- QilVisitor.cs
- DataServiceExpressionVisitor.cs
- UDPClient.cs
- MexNamedPipeBindingCollectionElement.cs
- TextEditorSelection.cs
- XmlSchemaImporter.cs
- XmlQuerySequence.cs
- KerberosRequestorSecurityToken.cs
- SwitchLevelAttribute.cs
- CursorInteropHelper.cs
- SerializationStore.cs
- EventHandlersStore.cs
- DataGridViewBand.cs
- NamespaceList.cs
- SineEase.cs
- CollectionViewSource.cs
- UserNameSecurityTokenProvider.cs
- PolicyException.cs
- StickyNoteContentControl.cs
- BooleanFacetDescriptionElement.cs
- ISessionStateStore.cs
- PathData.cs
- XmlSchemaObjectCollection.cs
- DataAccessor.cs
- ListenerElementsCollection.cs
- ListContractAdapter.cs
- WebPartConnectionCollection.cs
- CopyOnWriteList.cs
- AttachedPropertyMethodSelector.cs
- TextComposition.cs
- SerializationObjectManager.cs
- SamlConditions.cs
- Odbc32.cs
- LabelTarget.cs
- PaintValueEventArgs.cs
- ListBindingHelper.cs
- BoolExpressionVisitors.cs
- CommandLineParser.cs
- Transform3D.cs
- SQLDoubleStorage.cs
- _Semaphore.cs
- Policy.cs
- DataGridViewTextBoxCell.cs
- StylusPointPropertyId.cs
- TransactionFilter.cs
- MultiSelectRootGridEntry.cs
- PenContext.cs
- EmptyCollection.cs
- DivideByZeroException.cs
- AVElementHelper.cs
- NavigationProperty.cs
- AssemblyUtil.cs
- DetailsViewUpdatedEventArgs.cs
- XmlSortKey.cs
- GeneralTransform2DTo3D.cs
- Rotation3D.cs
- GlyphTypeface.cs
- ConnectionPool.cs
- AddInSegmentDirectoryNotFoundException.cs
- CommonProperties.cs
- NextPreviousPagerField.cs
- SchemaSetCompiler.cs
- IgnoreSection.cs
- QuaternionAnimation.cs
- ProfileParameter.cs
- Color.cs
- PropertyGeneratedEventArgs.cs
- Application.cs
- PermissionRequestEvidence.cs
- TreeView.cs
- SafeRightsManagementHandle.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- Base64Encoding.cs
- PropertyPushdownHelper.cs
- WizardForm.cs
- DBCSCodePageEncoding.cs
- SqlInternalConnectionSmi.cs
- IndentTextWriter.cs
- SchemaNamespaceManager.cs
- SchemaSetCompiler.cs
- KeyEvent.cs
- RemoteEndpointMessageProperty.cs