Partager via


SuspendExecution méthode

Indicates that the executable needs to suspend. This method is called by the runtime engine.

Espace de noms :  Microsoft.SqlServer.Dts.Tasks.SendMailTask
Assembly :  Microsoft.SqlServer.SendMailTask (dans Microsoft.SqlServer.SendMailTask.dll)

Syntaxe

'Déclaration
Public Sub SuspendExecution
'Utilisation
Dim instance As SendMailTask

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

Implémente

IDTSSuspend. . :: . .SuspendExecution() () () ()

Notes

This method is not used in code. It it called by the runtime when a breakpoint has been encountered.

However, you will need to provide code for this method, which is inherited from the IDTSSuspend class, if you write a multi-threaded custom task that exposes breakpoints. If your task is single threaded, which means that your implementation of Execute in your custom task does not start new threads, you do not need to implement this interface. For more information on writing custom tasks, see Développement d'une tâche personnalisée.

Exemples

The following code example is an example of an overridden SuspendExecution method for a custom task.

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)