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
- TextSearch.cs
- AnnotationResource.cs
- RotateTransform3D.cs
- DrawingDrawingContext.cs
- RecognizedAudio.cs
- ZoneLinkButton.cs
- EqualityArray.cs
- HttpResponse.cs
- ListQueryResults.cs
- ComEventsSink.cs
- NetStream.cs
- BrowserPolicyValidator.cs
- TextRangeEditLists.cs
- GetImportedCardRequest.cs
- brushes.cs
- SQLInt64Storage.cs
- RectAnimation.cs
- MediaContext.cs
- _KerberosClient.cs
- DrawingContext.cs
- RequestCachePolicy.cs
- CompiledQueryCacheEntry.cs
- QualifiedCellIdBoolean.cs
- GeometryCombineModeValidation.cs
- ObjectQueryExecutionPlan.cs
- FormViewUpdatedEventArgs.cs
- SemaphoreFullException.cs
- QilChoice.cs
- Process.cs
- LexicalChunk.cs
- PasswordPropertyTextAttribute.cs
- ClassValidator.cs
- MissingMemberException.cs
- ToolBarPanel.cs
- ObjectDesignerDataSourceView.cs
- MobileErrorInfo.cs
- MonthChangedEventArgs.cs
- AtlasWeb.Designer.cs
- ToolStripMenuItemDesigner.cs
- Renderer.cs
- PropertyItem.cs
- SourceSwitch.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- TextModifier.cs
- HeaderCollection.cs
- SystemIcmpV6Statistics.cs
- SchemaSetCompiler.cs
- EntityDataSourceMemberPath.cs
- StorageComplexTypeMapping.cs
- ProxySimple.cs
- HMACRIPEMD160.cs
- CheckBoxField.cs
- DrawingGroupDrawingContext.cs
- HtmlTable.cs
- PassportPrincipal.cs
- DataFormats.cs
- ClientData.cs
- QilNode.cs
- securitycriticaldata.cs
- AnchorEditor.cs
- IndependentAnimationStorage.cs
- Keywords.cs
- RadialGradientBrush.cs
- ParameterCollection.cs
- FamilyTypeface.cs
- IpcManager.cs
- PointF.cs
- DataObjectAttribute.cs
- Logging.cs
- AssemblyInfo.cs
- XmlDataDocument.cs
- SafeNativeMethods.cs
- Delegate.cs
- Rectangle.cs
- QueryCursorEventArgs.cs
- ClaimTypeElementCollection.cs
- SessionPageStateSection.cs
- TextDocumentView.cs
- TransformedBitmap.cs
- DirectoryInfo.cs
- DispatchRuntime.cs
- Membership.cs
- ControlBuilder.cs
- FormsIdentity.cs
- ScrollableControl.cs
- OleDbDataReader.cs
- SafeHGlobalHandleCritical.cs
- TraceListeners.cs
- XmlSerializer.cs
- StateItem.cs
- ScriptResourceAttribute.cs
- MtomMessageEncoder.cs
- UnionCodeGroup.cs
- SelectedDatesCollection.cs
- XmlMembersMapping.cs
- SystemIPv4InterfaceProperties.cs
- MissingMemberException.cs
- SqlMethods.cs
- PropertyPath.cs
- HttpListenerContext.cs