Udostępnij za pośrednictwem


Metoda WmiEventWatcherTask.SuspendExecution

Wskazuje, że plik wykonywalny musi zawiesić.Metoda ta jest wywoływana przez aparat runtime.

Przestrzeń nazw:  Microsoft.SqlServer.Dts.Tasks.WmiEventWatcherTask
Zestaw:  Microsoft.SqlServer.WMIEWTask (w Microsoft.SqlServer.WMIEWTask.dll)

Składnia

'Deklaracja
Public Sub SuspendExecution
'Użycie
Dim instance As WmiEventWatcherTask

instance.SuspendExecution()
public void SuspendExecution()
public:
virtual void SuspendExecution() sealed
abstract SuspendExecution : unit -> unit 
override SuspendExecution : unit -> unit 
public final function SuspendExecution()

Implementacje

IDTSSuspend.SuspendExecution()

Uwagi

Ta metoda nie jest używana w kodzie.Go ono wywoływane w czasie wykonywania, gdy napotkał punkt przerwania.

Jednakże należy podać kod dla metoda dziedziczone z IDTSSuspend klasy, jeśli piszesz wielowątkowych zadanie niestandardowe miejscami punkty przerwania.Jeśli zadanie jest pojedynczym wątku, co oznacza, że implementacji Execute w niestandardowe zadania nie można uruchomić nowych wątków, nie trzeba zaimplementować interfejs.Aby uzyskać więcej informacji na temat pisania niestandardowych zadań, zobacz Opracowywania niestandardowego zadania.

Przykłady

Poniższy przykład kodu jest przykładem zastąpiona SuspendExecution metoda niestandardowego zadania.

public void SuspendExecution() 
{
    lock (this) 
    {
        // If a suspend is required, do it. 
        if (m_suspendRequired != 0) 
           ChangeEvent(m_canExecute, false); 
        } 

        // The application cannot return from Suspend until the task
        // is suspended.
        // This can happen in one of two ways:
        // 1) The m_suspended event occurs, indicating that the 
        // execute thread has suspended, or 
        // 2) the canExecute flag is set, indicating that a suspend is
        // no longer required. 
        WaitHandle [] suspendOperationComplete = {m_suspended, m_canExecute};
        WaitHandle.WaitAny(suspendOperationComplete);
}
Public  Sub SuspendExecution()
    lock (Me)
    {
        If m_suspendRequired <> 0 Then
           ChangeEvent(m_canExecute, False)
        End If
    }
        ' The application cannot return from Suspend until the task
        ' is suspended. This can happen in one of two ways:
        ' 1) The m_suspended event occurs, indicating that the 
        ' execute thread has suspended, or 
        ' 2) the canExecute flag is set, indicating that a suspend is
        ' no longer required. 
        Dim suspendOperationComplete As WaitHandle() = {m_suspended, m_canExecute}
        WaitHandle.WaitAny(suspendOperationComplete)