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 |
---|---|
Requests that the CLR abort the task that the current ICLRTask instance represents. |
|
Notifies the CLR that the task associated with the current ICLRTask instance is ending, and attempts to shut the task down gracefully. |
|
Gets statistical information on the use of memory resources by the task represented by the current ICLRTask instance. |
|
Gets the number of locks currently held on the task. |
|
Gets a value indicating whether the host should assign a high priority to rescheduling the task represented by the current ICLRTask instance. |
|
Informs the CLR that the host has completed a task, and enables the CLR to reuse the current ICLRTask instance to represent another task. |
|
Causes the CLR to abort the task represented by the current ICLRTask instance immediately, without a guarantee that finalizers will be executed. |
|
Sets a unique identifier for the task represented by the current ICLRTask instance, for use in debugging. |
|
Notifies the CLR that the task represented by the current ICLRTask instance is in an operable state. |
|
Notifies the CLR that the task represented by the current ICLRTask instance is no longer in an operable state. |
|
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 and IHostTaskManager::EndThreadAffinity 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 SwitchOut 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: See .NET Framework System Requirements.
Header: MSCorEE.idl
Library: Included as a resource in MSCorEE.dll
.NET Framework Versions: 3.5 SP1, 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0