Compartir a través de


Thread.Freeze (Método)

Detiene la ejecución del subproceso.

Espacio de nombres:  EnvDTE
Ensamblado:  EnvDTE (en EnvDTE.dll)

Sintaxis

'Declaración
Sub Freeze
void Freeze()
void Freeze()
abstract Freeze : unit -> unit
function Freeze()

Comentarios

Para obtener más información, vea Cómo: Utilizar la ventana Subprocesos.

Ejemplos

En el siguiente ejemplo se muestra cómo utilizar el método Freeze.

Para probar este método

  1. Establezca el punto de interrupción dentro del método de devolución de llamada del subproceso de trabajo.

  2. Ejecute la aplicación de destino en el modo de depuración.

  3. Cuando la aplicación se detenga en el punto de interrupción, ejecute el complemento.

public static void FreezeThawTest(DTE 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(EnvDTE.Thread 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 EnvDTE.DTE)
    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 EnvDTE.Thread 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

Seguridad de .NET Framework

Vea también

Referencia

Thread Interfaz

EnvDTE (Espacio de nombres)

Thaw