Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / clr / src / BCL / Microsoft / Win32 / SafeHandles / SafeWaitHandle.cs / 2 / 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);
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- EncryptedXml.cs
- InfoCardPolicy.cs
- DbProviderFactories.cs
- PackageDocument.cs
- ListenerConnectionDemuxer.cs
- GridViewAutomationPeer.cs
- DataGridPreparingCellForEditEventArgs.cs
- ToolboxDataAttribute.cs
- XsltContext.cs
- RuntimeArgumentHandle.cs
- LogReserveAndAppendState.cs
- AnnotationAdorner.cs
- RolePrincipal.cs
- RawMouseInputReport.cs
- BufferedGraphics.cs
- MetadataArtifactLoaderFile.cs
- IERequestCache.cs
- SQLDoubleStorage.cs
- RectAnimationClockResource.cs
- SHA512Cng.cs
- WebPartEventArgs.cs
- Run.cs
- Duration.cs
- SmiRequestExecutor.cs
- EventMap.cs
- SendMailErrorEventArgs.cs
- WebControlAdapter.cs
- ComponentDesigner.cs
- CalendarDateRangeChangingEventArgs.cs
- NativeMethods.cs
- DBBindings.cs
- SystemEvents.cs
- SecurityTokenResolver.cs
- TraceListeners.cs
- ICspAsymmetricAlgorithm.cs
- CatalogPartChrome.cs
- SafeNativeMethods.cs
- DispatcherSynchronizationContext.cs
- CurrentChangedEventManager.cs
- ConfigPathUtility.cs
- GridViewUpdatedEventArgs.cs
- DataSetUtil.cs
- WebBrowsableAttribute.cs
- Send.cs
- XmlDictionaryReader.cs
- BinaryCommonClasses.cs
- ScrollChrome.cs
- FilteredXmlReader.cs
- WebPartZone.cs
- RoleServiceManager.cs
- WmfPlaceableFileHeader.cs
- HtmlImage.cs
- SerialStream.cs
- RSAOAEPKeyExchangeFormatter.cs
- DataGridViewTopLeftHeaderCell.cs
- CompositeScriptReferenceEventArgs.cs
- Rotation3DKeyFrameCollection.cs
- WebHttpBindingCollectionElement.cs
- EncoderReplacementFallback.cs
- ModelFactory.cs
- BamlLocalizabilityResolver.cs
- TCPClient.cs
- RegexRunner.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- SourceItem.cs
- ScrollBar.cs
- TextSimpleMarkerProperties.cs
- ListBoxItemAutomationPeer.cs
- DetailsViewRowCollection.cs
- BasicViewGenerator.cs
- RegexStringValidatorAttribute.cs
- TypeSource.cs
- HtmlSelect.cs
- _SSPISessionCache.cs
- SystemColors.cs
- ObjectComplexPropertyMapping.cs
- ProxyWebPartConnectionCollection.cs
- MatcherBuilder.cs
- TextEndOfSegment.cs
- SqlMethodAttribute.cs
- webeventbuffer.cs
- Paragraph.cs
- BlurEffect.cs
- TextFormatterContext.cs
- WindowsStatic.cs
- FreezableDefaultValueFactory.cs
- XmlSerializerVersionAttribute.cs
- TemplateParser.cs
- SqlBinder.cs
- TextStore.cs
- ConvertTextFrag.cs
- PopupEventArgs.cs
- CheckBoxFlatAdapter.cs
- WindowAutomationPeer.cs
- PassportIdentity.cs
- TypeDependencyAttribute.cs
- ToolTipAutomationPeer.cs
- PersonalizationProviderCollection.cs
- XmlSchemaRedefine.cs
- Focus.cs