Informs the common language runtime (CLR) that the host has completed a task, and enables the CLR to reuse the current ICLRTask instance to represent another task.
HRESULT Reset ( [in] BOOL fFull );
true, if the runtime should reset all thread-related static values in addition to the security and locale information related to the current
ICLRTask instance; otherwise,
|HOST_E_CLRNOTAVAILABLE||The CLR has not been loaded into a process, or the CLR is in a state in which it cannot run managed code or process the call. successfully|
|HOST_E_TIMEOUT||The call timed out.|
|HOST_E_NOT_OWNER||The caller does not own the lock.|
|HOST_E_ABANDONED||An event was canceled while a blocked thread or fiber was waiting on it.|
|E_FAIL||An unknown catastrophic failure occurred. When a method returns E_FAIL, the CLR is no longer usable within the process. Subsequent calls to hosting methods return HOST_E_CLRNOTAVAILABLE.|
The CLR can recycle previously created
ICLRTask instances to avoid the overhead of repeatedly creating new instances every time it needs a fresh task. The host enables this feature by calling
ICLRTask::Reset instead of ICLRTask::ExitTask when it has completed a task. The following list summarizes the normal life cycle of an
The runtime creates a new
The runtime calls IHostTaskManager::GetCurrentTask to get a reference to the current host task.
The runtime calls IHostTask::SetCLRTask to associate the new instance with the host task.
The task executes and completes.
The host destroys the task by calling
Reset alters this scenario in two ways. In step 5 above, the host calls
Reset to reset the task to a clean state, and then decouples the
ICLRTask instance from its associated IHostTask instance. If desired, the host can also cache the
IHostTask instance for reuse. In step 1 above, the runtime pulls a recycled
ICLRTask from the cache instead of creating a new instance.
This approach works well when the host also has a pool of reusable worker tasks. When the host destroys one of its
IHostTask instances, it destroys the corresponding
ICLRTask by calling
Platforms: See System Requirements.
Library: Included as a resource in MSCorEE.dll
.NET Framework Versions: Available since 2.0