System.Diagnostics.ProcessManager.OpenThread C# (CSharp) Method

OpenThread() public static method

public static OpenThread ( int threadId, int access ) : SafeThreadHandle
threadId int
access int
return SafeThreadHandle
        public static SafeThreadHandle OpenThread(int threadId, int access)
        {
            SafeThreadHandle threadHandle = Interop.Kernel32.OpenThread(access, false, threadId);
            int result = Marshal.GetLastWin32Error();
            if (threadHandle.IsInvalid)
            {
                if (result == Interop.Errors.ERROR_INVALID_PARAMETER)
                    throw new InvalidOperationException(SR.Format(SR.ThreadExited, threadId.ToString(CultureInfo.CurrentCulture)));
                throw new Win32Exception(result);
            }
            return threadHandle;
        }
    }

Usage Example

Example #1
0
 private Microsoft.Win32.SafeHandles.SafeThreadHandle OpenThreadHandle(int access)
 {
     this.EnsureState(State.IsLocal);
     return(ProcessManager.OpenThread(this.threadInfo.threadId, access));
 }
All Usage Examples Of System.Diagnostics.ProcessManager::OpenThread