Share via


DtsContainer.SuspendExecution Metode

Definisi

Dipanggil ketika executable perlu ditangguhkan. Metode ini dipanggil oleh mesin runtime.

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

Penerapan

Contoh

Contoh kode berikut adalah contoh metode yang ditimpa SuspendExecution untuk tugas kustom.

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)  

Keterangan

Metode ini tidak digunakan dalam kode. Ini dipanggil oleh runtime ketika titik henti telah ditemui.

Namun, Anda harus memberikan kode untuk metode ini, yang diwarisi dari IDTSSuspend kelas , jika Anda menulis tugas kustom multi-utas yang mengekspos titik henti. Jika tugas Anda berutas tunggal, yang berarti bahwa implementasi Execute Anda dalam tugas kustom Anda tidak memulai utas baru, Anda tidak perlu mengimplementasikan antarmuka ini. Untuk informasi selengkapnya tentang menulis tugas kustom, lihat Mengembangkan Tugas Kustom.

Berlaku untuk