WmiDataReaderTask.SuspendExecution Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Indica che l'eseguibile deve essere sospeso. Questo metodo è chiamato dal motore di runtime.
public:
virtual void SuspendExecution();
public void SuspendExecution();
abstract member SuspendExecution : unit -> unit
override this.SuspendExecution : unit -> unit
Public Sub SuspendExecution ()
Implementazioni
Esempio
Il seguente esempio di codice è un esempio di metodo sovrascritto SuspendExecution per un compito personalizzato.
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)
Commenti
Questo metodo non è usato nel codice. Indica il runtime quando è stato incontrato un punto di interruzione.
Tuttavia, dovrai fornire codice per questo metodo, che è ereditato dalla IDTSSuspend classe, se scrivi un task personalizzato multithread che espone i breakpoint. Se il tuo compito è a singolo thread, il che significa che la tua implementazione nel Execute tuo task personalizzato non avvia nuovi thread, non è necessario implementare questa interfaccia. Per maggiori informazioni sulla scrittura di compiti personalizzati, vedi Sviluppo di un compito personalizzato.