Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/classCThreadPool.html below:
NCBI C++ ToolKit: CThreadPool Class Reference
Search Toolkit Book for CThreadPool
Main class implementing functionality of pool of threads. More...
#include <util/thread_pool.hpp>
Collaboration diagram for CThreadPool:
[legend] Public Types enum EExclusiveFlags {
fDoNotAllowNewTasks = (1 << 0) , fFlushThreads = (1 << 1) , fCancelExecutingTasks = (1 << 2) , fCancelQueuedTasks = (1 << 3) ,
fExecuteQueuedTasks = (1 << 4)
} Binary flags indicating different possible options in what environment the pool will execute exclusive task. More...
enum EFlushType { eStartImmediately , eWaitToFinish } When to start new threads after flushing old ones. More...
typedef unsigned int TExclusiveFlags Type of bit-masked combination of several values from EExclusiveFlags. More...
Public Member Functions CThreadPool (unsigned int queue_size, unsigned int max_threads, unsigned int min_threads=2, CThread::TRunMode threads_mode=CThread::fRunDefault) Constructor. More...
void AddTask (CThreadPool_Task *task, const CTimeSpan *timeout=NULL) Add task to the pool for execution. More...
void CancelTask (CThreadPool_Task *task) Request to cancel the task and remove it from queue if it is there. More...
virtual ~CThreadPool (void) Destructor – will wait for all its threads to finish with the timeout set by CThreadPool::SetDestroyTimeout(); current default is 10 seconds. More...
void Abort (const CTimeSpan *timeout=NULL) Abort all functions of the pool – cancel all queued tasks, send cancellation notifications to all currently executing tasks. More...
CThreadPool (unsigned int queue_size, CThreadPool_Controller *controller, CThread::TRunMode threads_mode=CThread::fRunDefault) Constructor with custom controller. More...
void SetDestroyTimeout (const CTimeSpan &timeout) Set timeout to wait for all threads to finish before the pool should be able to destroy. More...
const CTimeSpan & GetDestroyTimeout (void) const Get timeout to wait for all threads to finish before the pool will be able to destroy. More...
void RequestExclusiveExecution (CThreadPool_Task *task, TExclusiveFlags flags=0) Add the task for exclusive execution in the pool By default the pool suspends all new and queued tasks processing, finishes execution of all currently executing tasks and then executes exclusive task in special thread devoted to this work. More...
void CancelTasks (TExclusiveFlags tasks_group) Cancel the selected groups of tasks in the pool. More...
void FlushThreads (EFlushType flush_type) Finish all current threads and replace them with new ones. More...
unsigned int GetThreadsCount (void) const Get total number of threads currently running in pool. More...
unsigned int GetQueuedTasksCount (void) const Get the number of tasks currently waiting in queue. More...
unsigned int GetExecutingTasksCount (void) const Get the number of currently executing tasks. More...
bool IsAborted (void) const Does method Abort() was already called for this ThreadPool. More...
Protected Member Functions virtual CThreadPool_Thread * CreateThread (void) Create new thread for the pool. More...
CMutex & GetMainPoolMutex (void) Get the mutex that protects all changes in the pool. More...
Private Member Functions CThreadPool (const CThreadPool &) Prohibit copying and assigning. More...
CThreadPool & operator= (const CThreadPool &) Private Attributes CThreadPool_Impl * m_Impl Actual implementation of the pool. More...
Friends class CThreadPool_Impl Detailed Description
Main class implementing functionality of pool of threads.
-
Note
-
This class can be safely used as a member of some other class or as a scoped variable; for more details see the destructor comments.
-
See also
-
~CThreadPool()
Definition at line 207 of file thread_pool.hpp.
The documentation for this class was generated from the following files:
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4