FileSystemTask.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 an Private integer declared in the custom task.
return m_suspendRequired != 0;
}
set
{
// This lock is also taken by Suspend(). Since 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 (this)
{
Interlocked.Exchange(ref m_suspendRequired, value ? 1 : 0);
if (!value)
ResumeExecution();
}
}
Public ReadOnly Property SuspendRequired() As Boolean
Get
' m_suspendRequired is an 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(). Since 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 it is set 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 在自訂工作中的實並不會啟動新的執行緒,您就不需要執行這個介面。 如需撰寫自訂工作的詳細資訊,請參閱 開發自訂工作。