DtsContainer.SuspendExecution Méthode

Définition

Appelée lorsque l'exécutable doit s'interrompre. Cette méthode est appelée par le moteur du runtime.

public:
 virtual void SuspendExecution();
public void SuspendExecution ();
abstract member SuspendExecution : unit -> unit
override this.SuspendExecution : unit -> unit
Public Sub SuspendExecution ()

Implémente

Exemples

L’exemple de code suivant est un exemple de méthode substituée SuspendExecution pour une tâche personnalisée.

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)  

Remarques

Cette méthode n’est pas utilisée dans le code. Il est appelé par le runtime lorsqu’un point d’arrêt a été rencontré.

Toutefois, vous devez fournir du code pour cette méthode, héritée de la IDTSSuspend classe, si vous écrivez une tâche personnalisée multithread qui expose des points d’arrêt. Si votre tâche est monothread, ce qui signifie que votre implémentation de Execute votre tâche personnalisée ne démarre pas de nouveaux threads, vous n’avez pas besoin d’implémenter cette interface. Pour plus d’informations sur l’écriture de tâches personnalisées, consultez Développement d’une tâche personnalisée.

S’applique à