Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeThreadHandle.cs / 1 / SafeThreadHandle.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
/*============================================================
**
** Class: SafeThreadHandle
**
**
** A wrapper for a thread handle
**
**
===========================================================*/
using System;
using System.Security;
using System.Diagnostics;
using System.Security.Permissions;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using Microsoft.Win32;
using Microsoft.Win32.SafeHandles;
using System.Runtime.ConstrainedExecution;
namespace Microsoft.Win32.SafeHandles {
[SuppressUnmanagedCodeSecurityAttribute]
internal sealed class SafeThreadHandle : SafeHandleZeroOrMinusOneIsInvalid
{
internal SafeThreadHandle() : base(true) {
}
internal void InitialSetHandle(IntPtr h){
Debug.Assert(base.IsInvalid, "Safe handle should only be set once");
base.SetHandle(h);
}
override protected bool ReleaseHandle() {
return SafeNativeMethods.CloseHandle(handle);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
/*============================================================
**
** Class: SafeThreadHandle
**
**
** A wrapper for a thread handle
**
**
===========================================================*/
using System;
using System.Security;
using System.Diagnostics;
using System.Security.Permissions;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using Microsoft.Win32;
using Microsoft.Win32.SafeHandles;
using System.Runtime.ConstrainedExecution;
namespace Microsoft.Win32.SafeHandles {
[SuppressUnmanagedCodeSecurityAttribute]
internal sealed class SafeThreadHandle : SafeHandleZeroOrMinusOneIsInvalid
{
internal SafeThreadHandle() : base(true) {
}
internal void InitialSetHandle(IntPtr h){
Debug.Assert(base.IsInvalid, "Safe handle should only be set once");
base.SetHandle(h);
}
override protected bool ReleaseHandle() {
return SafeNativeMethods.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
- ConstNode.cs
- MarkupObject.cs
- SafeSecurityHandles.cs
- RolePrincipal.cs
- MemoryRecordBuffer.cs
- GridViewDesigner.cs
- ActivityDelegate.cs
- SqlFormatter.cs
- GridViewUpdateEventArgs.cs
- _NestedMultipleAsyncResult.cs
- InternalSafeNativeMethods.cs
- CompilerWrapper.cs
- LineProperties.cs
- ProcessModuleCollection.cs
- RuleSetCollection.cs
- MenuEventArgs.cs
- DesignOnlyAttribute.cs
- QuaternionAnimation.cs
- PropertyGridDesigner.cs
- AutomationPropertyInfo.cs
- FormViewInsertedEventArgs.cs
- XmlSigningNodeWriter.cs
- LinearGradientBrush.cs
- MultiView.cs
- ImageConverter.cs
- LineBreakRecord.cs
- StrongNameIdentityPermission.cs
- BitmapMetadataEnumerator.cs
- MediaSystem.cs
- UriTemplateDispatchFormatter.cs
- ViewCellRelation.cs
- Roles.cs
- FlowNode.cs
- WindowsListViewGroupHelper.cs
- IncomingWebResponseContext.cs
- CompressedStack.cs
- ProcessHostFactoryHelper.cs
- connectionpool.cs
- PrimitiveDataContract.cs
- SQLMoneyStorage.cs
- CustomError.cs
- RequestCacheManager.cs
- NameSpaceExtractor.cs
- UnescapedXmlDiagnosticData.cs
- SetterBase.cs
- CasesDictionary.cs
- XmlNullResolver.cs
- SoapHeaders.cs
- DataGridViewSelectedColumnCollection.cs
- ResourceReferenceExpressionConverter.cs
- RichTextBox.cs
- HtmlLink.cs
- EventLevel.cs
- TextOptionsInternal.cs
- HebrewNumber.cs
- XD.cs
- TableSectionStyle.cs
- CodeDirectionExpression.cs
- SingleResultAttribute.cs
- EventBookmark.cs
- LocatorManager.cs
- TransportSecurityProtocol.cs
- TableCellCollection.cs
- ConfigXmlSignificantWhitespace.cs
- XmlKeywords.cs
- ComboBox.cs
- WebPartExportVerb.cs
- MarkupExtensionSerializer.cs
- MemberAccessException.cs
- BitmapEffectGeneralTransform.cs
- DependencySource.cs
- StringWriter.cs
- panel.cs
- HashJoinQueryOperatorEnumerator.cs
- Point3DValueSerializer.cs
- QueryStringParameter.cs
- InteropAutomationProvider.cs
- HttpCacheVaryByContentEncodings.cs
- EventEntry.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- ParallelActivityDesigner.cs
- ImageListStreamer.cs
- TableHeaderCell.cs
- CatalogPartCollection.cs
- BaseProcessor.cs
- COM2ExtendedTypeConverter.cs
- PointHitTestParameters.cs
- ListViewSelectEventArgs.cs
- ConstructorExpr.cs
- WeakReadOnlyCollection.cs
- ObjectHandle.cs
- CodeExpressionRuleDeclaration.cs
- HostingEnvironmentSection.cs
- webproxy.cs
- FreezableCollection.cs
- OleDbInfoMessageEvent.cs
- GraphicsContainer.cs
- SoapEnumAttribute.cs
- DocumentAutomationPeer.cs
- ComplexPropertyEntry.cs