ScriptTask.SuspendRequired プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
タスクがブレークポイントに遭遇した際に実行を一時停止すべきかどうかを示すブール値を取得または設定します。 この値は、ブレークポイントが発生した際にタスクやコンテナのランタイムエンジンによって設定されます。
public:
property bool SuspendRequired { bool get(); void set(bool value); };
public bool SuspendRequired { get; set; }
member this.SuspendRequired : bool with get, set
Public Property SuspendRequired As Boolean
プロパティ値
タスクがブレークポイントに遭遇した際に実行を一時停止する場合、trueとなります。そうでなければ、誤りです。
実装
例
以下のコード例は、カスタムタスクで SuspendRequired プロパティをオーバーライドする方法を示しています。
public bool SuspendRequired
{
get
{
// m_suspendRequired is a Private integer declared in the custom task.
return m_suspendRequired != 0;
}
set
{
// This lock is also taken by Suspend(). Because it is possible for the package to be
// suspended and resumed in quick succession, this property "set" might happen
// before the actual Suspend() call. Without the lock, the Suspend() might reset
// the canExecute event after we set it to abort the suspension.
lock (this)
{
Interlocked.Exchange(ref m_suspendRequired, value ? 1 : 0);
if (!value)
ResumeExecution();
}
}
Public ReadOnly Property SuspendRequired() As Boolean
Get
' m_suspendRequired is a Private integer declared in the custom task.
Return m_suspendRequired <> 0
End Get
Public WriteOnly Property SuspendRequired() As Boolean
Set (ByVal Value As Boolean)
' This lock is also taken by Suspend(). Because it is possible for the package to be
' suspended and resumed in quick succession, this property "put" might happen
' before the actual Suspend() call. Without the lock, the Suspend() might reset
' the canExecute event after we set it to abort the suspension.
lock (Me)
{
Interlocked.Exchange(m_suspendRequired, value ? 1 : 0)
If Not value Then
ResumeExecution()
End If
}
End Set
End Property
注釈
この性質はコード上設定されていません。 このプロパティは、ブレークポイントに遭遇したタスクやコンテナのランタイムによって設定されます。
しかし、ブレークポイントを公開するマルチスレッドカスタムタスクを書く場合は、このメソッドのコードを提供しなければならず、これはマルチスレッドオブジェクトの IDTSSuspend クラスから継承されます。 タスクがシングルスレッドの場合、つまりカスタムタスクの Execute 実装が新しいスレッドを起動しない場合、このインターフェースを実装する必要はありません。 カスタムタスクの作成に関する詳細は 「カスタムタスクの開発」をご覧ください。