共用方式為


IHostThreadPoolManager Interface

Provides methods that enable the common language runtime (CLR) to configure the thread pool and to queue work items to the thread pool.

interface IHostThreadpoolManager : IUnknown {
    HRESULT GetAvailableThreads ( 
        [out] DWORD *pdwAvailableWorkerThreads
    );
    HRESULT GetMaxThreads ( 
        [out] DWORD *pdwMaxThreads
    );
    HRESULT GetMinThreads ( 
        [out] DWORD *MinThreads
    );
    HRESULT QueueUserWorkItem ( 
        [in] LPTHREAD_START_ROUTINE Function,
        [in] PVOID Context,
        [in] ULONG Flags
    );
    HRESULT SetMaxThreads (
        [in] DWORD MaxThreads
    );
    HRESULT SetMinThreads (
        [in] DWORD MinThreads
    );
};

Methods

Method

Description

IHostThreadPoolManager::GetAvailableThreads Method

Gets the number of threads in the thread pool that are not currently processing work items.

IHostThreadPoolManager::GetMaxThreads Method

Gets the maximum number of threads that the host maintains concurrently in the thread pool.

IHostThreadPoolManager::GetMinThreads Method

Gets the minimum number of idle threads that the host maintains in anticipation of requests.

IHostThreadPoolManager::QueueUserWorkItem Method

Queues a function for execution, and provides an object containing data to be used by the function.

IHostThreadPoolManager::SetMaxThreads Method

Sets the maximum number of threads that the host can maintain in the thread pool.

IHostThreadPoolManager::SetMinThreads Method

Sets the minimum number of idle threads that the host must maintain in anticipation of requests.

Remarks

The host is not required to configure the thread pool by using the values specified in calls to the SetMaxThreads and SetMinThreads methods. In this case, the host should return an HRESULT value of E_NOTIMPL from these methods.

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

Concepts

Hosting Interfaces

Reference

System.Threading

ThreadPool