RLib  5.7
RLib - an opensource, lightweight and multi-platform framework for cpp programming
System::Threading::ThreadPool Class Reference

线程池支持类 More...

Public Member Functions

 ThreadPool (const ThreadPool &)=delete
 
ThreadPooloperator= (const ThreadPool &)=delete
 
 ThreadPool (intptr_t defaultMinThreads=4, intptr_t defaultMaxThreads=1024, intptr_t defaultMaxIdleTime=6000)
 
bool IsDestroying ()
 
bool IsTasksComplete ()
 
void WaitForTasksComplete (DWORD interval=6000, bool bAlertable=true)
 
void Alert ()
 
void Abort ()
 
void Reset ()
 
void PausePendingTasks ()
 
void ResumePendingTasks ()
 
void FinalizePendingTasks ()
 
intptr_t GetAvailableThreads ()
 
intptr_t GetThreads ()
 
intptr_t GetMaxThreads ()
 
intptr_t GetMinThreads ()
 
intptr_t GetMaxIdleTime ()
 
intptr_t GetTasks ()
 
bool AddTask (ThreadPoolExecutor callBack, LPVOID state)
 
bool AddTask (Runnable::CppThreadStart callBack)
 
template<typename T >
bool AddTask (void(_cdecl *callBack)(T), T state)
 
template<typename T >
bool InvokeAndWait (void(_cdecl *callBack)(T), T state)
 
RLIB_INLINE bool InvokeAndWait (Runnable::CppThreadStart callBack)
 
bool QueueUserWorkItem (ThreadPoolExecutor callBack, LPVOID state)
 
bool QueueUserWorkItem (Runnable::CppThreadStart callBack)
 
template<typename T >
bool QueueUserWorkItem (void(_cdecl *callBack)(T), T state)
 
template<typename T >
bool InvokeLater (void(_cdecl *callBack)(T), T state)
 
RLIB_INLINE bool InvokeLater (Runnable::CppThreadStart callBack)
 
bool SetMaxThreads (intptr_t workerThreads)
 
bool SetMinThreads (intptr_t workerThreads)
 
bool SetMaxIdleTime (intptr_t maxIdleTime)
 
bool Dispatch ()
 

Public Attributes

 RLIB_DECLARE_DYNCREATE
 

Protected Attributes

TaskQueue m_tasks
 
WorkerList m_workers
 
TempWorkerList m_avail_workers
 
volatile intptr_t m_nMinThreads
 
volatile intptr_t m_nMaxThreads
 
volatile intptr_t m_nMaxIdleTime
 
volatile long m_nDestroying
 
volatile long m_nPending
 

Detailed Description

线程池支持类

Member Function Documentation

template<typename T >
bool System::Threading::ThreadPool::AddTask ( void(_cdecl *callBack)(T)  ,
state 
)
inline

See also
AddTask
template<typename T >
bool System::Threading::ThreadPool::InvokeAndWait ( void(_cdecl *callBack)(T)  ,
state 
)
inline

See also
AddTask
RLIB_INLINE bool System::Threading::ThreadPool::InvokeAndWait ( Runnable::CppThreadStart  callBack)
inline

See also
AddTask
template<typename T >
bool System::Threading::ThreadPool::InvokeLater ( void(_cdecl *callBack)(T)  ,
state 
)
inline
See also
QueueUserWorkItem
RLIB_INLINE bool System::Threading::ThreadPool::InvokeLater ( Runnable::CppThreadStart  callBack)
inline

See also
QueueUserWorkItem
template<typename T >
bool System::Threading::ThreadPool::QueueUserWorkItem ( void(_cdecl *callBack)(T)  ,
state 
)
inline

See also
QueueUserWorkItem

The documentation for this class was generated from the following files: