Thread2.Thaw 方法
允许线程继续执行。
命名空间: EnvDTE90
程序集: EnvDTE90(在 EnvDTE90.dll 中)
语法
声明
Sub Thaw
void Thaw()
void Thaw()
abstract Thaw : unit -> unit
function Thaw()
备注
线程被冻结后,此方法允许线程继续执行。
示例
下面的示例演示如何使用 Freeze 方法。
若要测试此方法,请执行下列操作:
在辅助线程的回调方法内设置断点。
以调试模式运行目标应用程序。
当应用程序停在该断点处时,运行外接程序。
public static void FreezeThawTest(DTE2 dte)
{
// Setup debug Output window.
Window w =
(Window)dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
w.Visible = true;
OutputWindow ow = (OutputWindow)w.Object;
OutputWindowPane owp = ow.OutputWindowPanes.Add("Thread Freeze Thaw
Test");
owp.Activate();
EnvDTE.Threads threads = dte.Debugger.CurrentProgram.Threads;
owp.OutputString("There are " + threads.Count + " threads:\n");
foreach(EnvDTE90.Thread2 thread in threads)
{
owp.OutputString("\nThread: " + thread.ID + " Name: " +
thread.Name);
owp.OutputString("\n Is frozen : " +
thread.IsFrozen);
owp.OutputString("\n Freezing . . . ");
thread.Freeze();
owp.OutputString("\n Is frozen : " +
thread.IsFrozen);
owp.OutputString("\n Thawing . . . ");
thread.Thaw();
owp.OutputString("\n Is frozen : " +
thread.IsFrozen);
}
}
Shared Sub FreezeThawTest(ByRef dte As EnvDTE80.DTE2)
Dim str As String
Dim threads As EnvDTE.Threads = dte.Debugger.CurrentProgram.Threads
str = "There are " + threads.Count.ToString() + " threads running."
For Each thread As EnvDTE90.Thread2 In threads
str += vbCrLf + vbCrLf + " Thread: " + thread.ID.ToString()
str += vbCrLf + vbCrLf + " Is frozen: " + _
thread.IsFrozen.ToString()
str += vbCrLf + vbCrLf + " Freezing ... "
thread.Freeze()
str += vbCrLf + vbCrLf + " Is frozen: " + _
thread.IsFrozen.ToString()
str += vbCrLf + vbCrLf + " Thawing ... "
thread.Thaw()
str += vbCrLf + vbCrLf + " Is frozen: " + _
thread.IsFrozen.ToString()
Next
MessageBox.Show(str, "Thread Freeze Thaw Test")
End Sub
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。