Udostępnij przez


Metoda IDTSSuspend.SuspendExecution

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

Przestrzeń nazw:  Microsoft.SqlServer.Dts.Runtime
Zestaw:  Microsoft.SqlServer.ManagedDTS (w Microsoft.SqlServer.ManagedDTS.dll)

Składnia

'Deklaracja
Sub SuspendExecution
'Użycie
Dim instance As IDTSSuspend

instance.SuspendExecution()
void SuspendExecution()
void SuspendExecution()
abstract SuspendExecution : unit -> unit 
function 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)