언어

SendMailTask.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 물려받은 것으로, 브레이크포인트를 노출하는 작업입니다. 만약 작업이 단일 스레드(single-threaded)라면, 즉 커스텀 작업에서 구현 Execute 된 것이 새 스레드를 시작하지 않는다면, 이 인터페이스를 구현할 필요가 없습니다. 맞춤형 작업 작성에 대한 자세한 내용은 "맞춤형 작업 개발"을 참조하세요.

적용 대상