WmiDataReaderTask.SuspendExecution メソッド

定義

実行ファイルが一時停止する必要があることを示します。 このメソッドはランタイムエンジンによって呼び出されます。

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

実装

以下のコード例は、カスタムタスクのオーバーライドされた 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)  

注釈

この方法はコードでは使われていません。 ブレークポイントが発生したときに実行時間で呼び出します。

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

適用対象