Share via


ICLRTask Interface

Provides methods that allow the host to make requests of the common language runtime (CLR), or to provide notification to the CLR about the associated task.

interface ICLRTask : IUnknown {
    HRESULT Abort ();
    HRESULT ExitTask ();
    HRESULT GetMemStats (
        [out] COR_GC_THREAD_STATS *pMemUsage
    );
    HRESULT LocksHeld (
        [out] SIZE_T *pLockCount
    );
    HRESULT NeedsPriorityScheduling (
        [out] BOOL *pbNeedsPriorityScheduling
    );
    HRESULT Reset (
        [in] BOOL fFull
    );
    HRESULT RudeAbort ();
    HRESULT SetTaskIdentifier (
        [in] DWORD asked
    );
    HRESULT SwitchIn (
        [in] HANDLE threadHandle
    );
    HRESULT SwitchOut ();
    HRESULT YieldTask ();
}

Methods

Method Description

ICLRTask::Abort Method

Requests that the CLR abort the task that the current ICLRTask instance represents.

ICLRTask::ExitTask Method

Notifies the CLR that the task associated with the current ICLRTask instance is ending, and attempts to shut the task down gracefully.

ICLRTask::GetMemStats Method

Gets statistical information on the use of memory resources by the task represented by the current ICLRTask instance.

ICLRTask::LocksHeld Method

Gets the number of locks currently held on the task.

ICLRTask::NeedsPriorityScheduling Method

Gets a value indicating whether the host should assign a high priority to rescheduling the task represented by the current ICLRTask instance.

ICLRTask::Reset Method

Informs the CLR that the host has completed a task, and enables the CLR to reuse the current ICLRTask instance to represent another task.

ICLRTask::RudeAbort Method

Causes the CLR to abort the task represented by the current ICLRTask instance immediately, without a guarantee that finalizers will be executed.

ICLRTask::SetTaskIdentifier Method

Sets a unique identifier for the task represented by the current ICLRTask instance, for use in debugging.

ICLRTask::SwitchIn Method

Notifies the CLR that the task represented by the current ICLRTask instance is in an operable state.

ICLRTask::SwitchOut Method

Notifies the CLR that the task represented by the current ICLRTask instance is no longer in an operable state.

ICLRTask::YieldTask Method

Requests that the CLR make processor time available to other tasks. The CLR makes no guarantee that the task will be put in a state where it can yield processing time.

Remarks

An ICLRTask is the representation of a task for the CLR. At any point during code execution, a task can be described either as running or waiting to run. The host calls the ICLRTask::SwitchIn method to notify the CLR that the task that the current ICLRTask instance represents is now in an operable state. After a call to ICLRTask::SwitchIn, the host can schedule the task on any operating system thread, except in cases where the runtime requires thread-affinity, as specified by calls to the IHostTaskManager::BeginThreadAffinity Method and IHostTaskManager::EndThreadAffinity Method methods. Some time later, the operating system might decide to remove the task from the thread and place it in a non-running state. For example, this might happen whenever the task blocks on synchronization primitives, or waits for I/O operations to complete. The host calls ICLRTask::SwitchOut Method to notify the CLR that the task represented by the current ICLRTask instance is no longer in an operable state.

A task typically terminates at the end of code execution. At that time, the host calls ICLRTask::ExitTask to destroy the associated ICLRTask. However, tasks can also be recycled by using a call to ICLRTask::Reset, which allows the ICLRTask instance to be used again. This approach prevents the overhead of repeatedly creating and destroying instances.

Requirements

Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: MSCorEE.idl

Library: Included as a resource in MSCorEE.dll

.NET Framework Version: 2.0

See Also

Reference

ICLRTaskManager Interface
IHostTask Interface
IHostTaskManager Interface

Other Resources

Hosting Interfaces