SuspendExecution メソッド

実行可能ファイルを中断する必要がある場合に呼び出されます。このメソッドはランタイム エンジンから呼び出されます。

名前空間:  Microsoft.SqlServer.Dts.Tasks.Exec80PackageTask
アセンブリ:  Microsoft.SqlServer.Exec80PackageTask (Microsoft.SqlServer.Exec80PackageTask.dll)

構文

'宣言
Public Sub SuspendExecution
'使用
Dim instance As Exec80PackageTask

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

実装

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

説明

このメソッドはコードでは使用されません。ブレークポイントに到達したときにランタイムから呼び出されます。

ただし、ブレークポイントを公開するマルチスレッド カスタム タスクを作成する場合は、IDTSSuspend クラスから継承されるこのメソッドのコードを指定する必要があります。タスクがシングル スレッドであり、カスタム タスクで Execute を実装しても新しいスレッドが起動されない場合は、このインターフェイスを実装する必要はありません。カスタム タスクの作成の詳細については、「カスタム タスクの開発」を参照してください。

使用例

次のコードは、カスタム タスクのオーバーライドされた SuspendExecution メソッドの例です。

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)