XMLTask.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)  

注解

此方法可用于 XMLTask ,而不考虑 OperationType 值。

此方法不在代码中使用。 它在遇到断点时由运行时调用。

但是, IDTSSuspend 如果编写公开断点的多线程自定义任务,则需要提供此方法的代码,该方法是从类继承的。 如果你的任务是单线程的,这意味着你 Execute 在自定义任务中的实现不会启动新线程,则无需实现此接口。 有关编写自定义任务的详细信息,请参阅 开发自定义任务

适用于