Share via


IDTSSuspend.SuspendRequired Properti

Definisi

Mendapatkan atau mengatur Boolean yang menunjukkan apakah tugas harus ditangguhkan saat menemukan titik henti. Nilai ini ditetapkan oleh mesin runtime untuk tugas dan kontainer saat titik henti ditemui.

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

Nilai Properti

true jika tugas menangguhkan ketika menemukan titik henti.

Contoh

Contoh kode berikut adalah contoh properti yang ditimpa SuspendRequired untuk tugas kustom.

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  

Keterangan

Properti tidak diatur dalam kode. Ini diatur oleh runtime untuk tugas dan kontainer ketika titik henti 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