Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / clr / src / BCL / Microsoft / Win32 / SafeHandles / SafeWaitHandle.cs / 5 / SafeWaitHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeWaitHandle ** ** ** A wrapper for Win32 events (mutexes, auto reset events, and ** manual reset events). Used by WaitHandle. ** ** ===========================================================*/ using System; using System.Security; using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; using System.Runtime.Versioning; using Microsoft.Win32; using System.Threading; namespace Microsoft.Win32.SafeHandles { [SecurityPermission(SecurityAction.LinkDemand,UnmanagedCode=true)] public sealed class SafeWaitHandle : SafeHandleZeroOrMinusOneIsInvalid { // Called by P/Invoke marshaler private SafeWaitHandle() : base(true) { } [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public SafeWaitHandle(IntPtr existingHandle, bool ownsHandle) : base(ownsHandle) { SetHandle(existingHandle); } [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] override protected bool ReleaseHandle() { return Win32Native.CloseHandle(handle); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeWaitHandle ** ** ** A wrapper for Win32 events (mutexes, auto reset events, and ** manual reset events). Used by WaitHandle. ** ** ===========================================================*/ using System; using System.Security; using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; using System.Runtime.Versioning; using Microsoft.Win32; using System.Threading; namespace Microsoft.Win32.SafeHandles { [SecurityPermission(SecurityAction.LinkDemand,UnmanagedCode=true)] public sealed class SafeWaitHandle : SafeHandleZeroOrMinusOneIsInvalid { // Called by P/Invoke marshaler private SafeWaitHandle() : base(true) { } [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public SafeWaitHandle(IntPtr existingHandle, bool ownsHandle) : base(ownsHandle) { SetHandle(existingHandle); } [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] override protected bool ReleaseHandle() { return Win32Native.CloseHandle(handle); } } } // 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
- ScriptRef.cs
- XmlDocumentType.cs
- DataColumnChangeEvent.cs
- EncryptRequest.cs
- ConnectionProviderAttribute.cs
- Int32CAMarshaler.cs
- ActivityDesignerResources.cs
- ProcessHostServerConfig.cs
- Bitmap.cs
- Point3DAnimation.cs
- CodeStatement.cs
- SqlProcedureAttribute.cs
- Rfc2898DeriveBytes.cs
- GridItemPattern.cs
- AutomationPeer.cs
- DesignerSerializerAttribute.cs
- EventProxy.cs
- UdpContractFilterBehavior.cs
- MessageProperties.cs
- ItemDragEvent.cs
- Descriptor.cs
- IisTraceWebEventProvider.cs
- AnnotationService.cs
- BinaryObjectInfo.cs
- DateTimeEditor.cs
- ManagementEventWatcher.cs
- MetadataArtifactLoaderCompositeResource.cs
- OrderedDictionary.cs
- XmlHelper.cs
- DelimitedListTraceListener.cs
- SchemaTypeEmitter.cs
- DbgUtil.cs
- ExceptionHelpers.cs
- RadioButton.cs
- DataGridViewColumnConverter.cs
- XpsFixedDocumentSequenceReaderWriter.cs
- DbMetaDataFactory.cs
- wgx_exports.cs
- MsmqProcessProtocolHandler.cs
- ObjectConverter.cs
- EntityDataReader.cs
- NavigationProgressEventArgs.cs
- BamlResourceDeserializer.cs
- ListViewUpdatedEventArgs.cs
- _OverlappedAsyncResult.cs
- ErrorRuntimeConfig.cs
- NetworkCredential.cs
- SqlBooleanMismatchVisitor.cs
- PropertyConverter.cs
- TimeSpanSecondsConverter.cs
- CompilerState.cs
- SoapExtensionReflector.cs
- ElementNotEnabledException.cs
- FrameworkElementAutomationPeer.cs
- ResourceProviderFactory.cs
- FormClosingEvent.cs
- StylusCaptureWithinProperty.cs
- TextTreeObjectNode.cs
- ArrangedElement.cs
- XXXInfos.cs
- BinaryObjectReader.cs
- Timer.cs
- RoleManagerEventArgs.cs
- DataListItemCollection.cs
- FormatVersion.cs
- XmlEnumAttribute.cs
- ServiceOperationInvoker.cs
- Converter.cs
- SkipQueryOptionExpression.cs
- HelpEvent.cs
- DescendantBaseQuery.cs
- SqlNode.cs
- EventRoute.cs
- DataGridViewCell.cs
- QualificationDataAttribute.cs
- XmlSerializerNamespaces.cs
- SplineQuaternionKeyFrame.cs
- DateTimeOffsetAdapter.cs
- HotSpot.cs
- DataGridViewColumnStateChangedEventArgs.cs
- TextServicesLoader.cs
- Util.cs
- RIPEMD160.cs
- FileLevelControlBuilderAttribute.cs
- Function.cs
- SqlBulkCopyColumnMappingCollection.cs
- KnownAssemblyEntry.cs
- MessageHeaderDescriptionCollection.cs
- MonitorWrapper.cs
- DynamicResourceExtension.cs
- XmlRootAttribute.cs
- CompressionTransform.cs
- WindowsGraphics.cs
- bindurihelper.cs
- EntryIndex.cs
- TransactionFilter.cs
- Frame.cs
- UIElementCollection.cs
- TextPointerBase.cs
- CachedPathData.cs