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
- SystemIcons.cs
- XmlSchemaAttributeGroupRef.cs
- Common.cs
- PassportPrincipal.cs
- NativeCppClassAttribute.cs
- NameTable.cs
- EntityCommand.cs
- SeparatorAutomationPeer.cs
- _ContextAwareResult.cs
- SchemaMapping.cs
- _SingleItemRequestCache.cs
- ServiceTimeoutsElement.cs
- ExceptionUtility.cs
- TdsParameterSetter.cs
- DataGridToolTip.cs
- BuildManager.cs
- PropertyPushdownHelper.cs
- PagerSettings.cs
- DataGridCaption.cs
- Point4D.cs
- HashMembershipCondition.cs
- CharKeyFrameCollection.cs
- InheritanceContextHelper.cs
- Int32Storage.cs
- DecimalAnimation.cs
- Debug.cs
- BinaryFormatterWriter.cs
- ListSortDescription.cs
- RequestChannel.cs
- DES.cs
- ToolStripItemClickedEventArgs.cs
- CodeNamespaceImportCollection.cs
- DPTypeDescriptorContext.cs
- SymmetricAlgorithm.cs
- XamlTemplateSerializer.cs
- OleCmdHelper.cs
- EventMappingSettings.cs
- CatchDesigner.xaml.cs
- SizeConverter.cs
- XXXInfos.cs
- LiteralTextParser.cs
- SponsorHelper.cs
- _ShellExpression.cs
- Frame.cs
- AdornerLayer.cs
- FigureHelper.cs
- ConfigXmlText.cs
- DynamicUpdateCommand.cs
- SoapDocumentServiceAttribute.cs
- SqlIdentifier.cs
- PagerSettings.cs
- ConstructorExpr.cs
- ConvertTextFrag.cs
- CellQuery.cs
- FixedHighlight.cs
- EventMemberCodeDomSerializer.cs
- ClickablePoint.cs
- EntityViewContainer.cs
- TreeBuilder.cs
- PropertyMap.cs
- UserPreference.cs
- LinkGrep.cs
- Int16AnimationUsingKeyFrames.cs
- WebEventCodes.cs
- ImageDrawing.cs
- SqlDelegatedTransaction.cs
- StylusPoint.cs
- ManipulationInertiaStartingEventArgs.cs
- ScopeCollection.cs
- SaveFileDialog.cs
- Point3DCollection.cs
- RegexGroup.cs
- SoapSchemaExporter.cs
- RulePatternOps.cs
- COM2IDispatchConverter.cs
- CancelRequestedRecord.cs
- SafeLocalAllocation.cs
- ToolStripOverflowButton.cs
- EntityDataSourceViewSchema.cs
- InvariantComparer.cs
- IssuanceLicense.cs
- Double.cs
- EntityReference.cs
- FixedPosition.cs
- EnumerableRowCollectionExtensions.cs
- MailSettingsSection.cs
- ListBoxChrome.cs
- DynamicArgumentDialog.cs
- FieldTemplateFactory.cs
- PanelDesigner.cs
- HtmlDocument.cs
- ClientApiGenerator.cs
- WmpBitmapDecoder.cs
- MenuItem.cs
- UnsafeNativeMethodsCLR.cs
- precedingsibling.cs
- OutputCacheSection.cs
- CommonXSendMessage.cs
- DelegatingMessage.cs
- EnumerableWrapperWeakToStrong.cs