A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/group__ThreadedPools.html below:

Threaded Pools for Request Handling

enum   CThreadPool_Task::EStatus {
  CThreadPool_Task::eIdle , CThreadPool_Task::eQueued , CThreadPool_Task::eExecuting , CThreadPool_Task::eCompleted ,
  CThreadPool_Task::eFailed , CThreadPool_Task::eCanceled
}   Status of the task. More...
  enum   CThreadPool::EExclusiveFlags {
  CThreadPool::fDoNotAllowNewTasks = (1 << 0) , CThreadPool::fFlushThreads = (1 << 1) , CThreadPool::fCancelExecutingTasks = (1 << 2) , CThreadPool::fCancelQueuedTasks = (1 << 3) ,
  CThreadPool::fExecuteQueuedTasks = (1 << 4)
}   Binary flags indicating different possible options in what environment the pool will execute exclusive task. More...
  enum   CThreadPool::EFlushType { CThreadPool::eStartImmediately , CThreadPool::eWaitToFinish }   When to start new threads after flushing old ones. More...
  enum   CThreadPool_Controller::EEvent { CThreadPool_Controller::eSuspend , CThreadPool_Controller::eResume , CThreadPool_Controller::eOther }   Events that can happen with ThreadPool. More...
  enum   CThreadPoolException::EErrCode {
  CThreadPoolException::eControllerBusy , CThreadPoolException::eTaskBusy , CThreadPoolException::eProhibited , CThreadPoolException::eInactive ,
  CThreadPoolException::eInvalid
}   enum   CQueueItemBase::EStatus {
  CQueueItemBase::ePending , CQueueItemBase::eActive , CQueueItemBase::eComplete , CQueueItemBase::eWithdrawn ,
  CQueueItemBase::eForciblyCaught
}   enum   CThreadInPool< TRequest >::ERunMode { CThreadInPool< TRequest >::eNormal , CThreadInPool< TRequest >::eRunOnce }   Thread run mode. More...
  enum   CStdPoolOfThreads::EKillFlags { CStdPoolOfThreads::fKill_Wait = 0x1 , CStdPoolOfThreads::fKill_Reopen = 0x2 }     CQueueItemBase_ForServer::CQueueItemBase_ForServer (void)   const EStatusCQueueItemBase_ForServer::GetStatus (void) const   void  CQueueItemBase_ForServer::MarkAsComplete (void)   void  CQueueItemBase_ForServer::MarkAsForciblyCaught (void)   virtual void  CQueueItemBase_ForServer::x_SetStatus (EStatus new_status)     CBlockingQueue_ForServer::CCompletingHandle::CCompletingHandle (const TItemHandle &h)     CBlockingQueue_ForServer::CCompletingHandle::~CCompletingHandle ()     CBlockingQueue_ForServer::CBlockingQueue_ForServer (void)   Constructor. More...
  TItemHandle  CBlockingQueue_ForServer::Put (const TRequest &request)   Put a request into the queue. More...
  TItemHandle  CBlockingQueue_ForServer::GetHandle (void)   Get the first available request from the queue, and return a handle to it. More...
    CBlockingQueue_ForServer::CQueueItem::CQueueItem (TRequest request)   const TRequestCBlockingQueue_ForServer::CQueueItem::GetRequest (void) const   void  CBlockingQueue_ForServer::CQueueItem::x_SetStatus (EStatus new_status)     CBlockingQueue_ForServer::CBlockingQueue_ForServer (const CBlockingQueue_ForServer &)   forbidden More...
  CBlockingQueue_ForServerCBlockingQueue_ForServer::operator= (const CBlockingQueue_ForServer &)     CThreadInPool_ForServer::CThreadInPool_ForServer (TPool *pool)   Constructor. More...
  void  CThreadInPool_ForServer::CountSelf (void)   virtual  CThreadInPool_ForServer::~CThreadInPool_ForServer (void)   Destructor. More...
  void  CThreadInPool_ForServer::ProcessRequest (TItemHandle handle)   Process a request. More...
  void  CThreadInPool_ForServer::ProcessRequest (const TRequest &req)   Older interface (still delegated to by default) More...
  virtual void *  CThreadInPool_ForServer::Main (void)   Derived (user-created) class must provide a real thread function. More...
  void  CThreadInPool_ForServer::x_HandleOneRequest (bool catch_all)   void  CThreadInPool_ForServer::x_UnregisterThread (void)     CThreadInPool_ForServer::CAutoUnregGuard::CAutoUnregGuard (TThread *thr)     CThreadInPool_ForServer::CAutoUnregGuard::~CAutoUnregGuard (void)     CPoolOfThreads_ForServer::CPoolOfThreads_ForServer (unsigned int max_threads, const string &thr_suffix)   Constructor. More...
  virtual  CPoolOfThreads_ForServer::~CPoolOfThreads_ForServer (void)   Destructor. More...
  void  CPoolOfThreads_ForServer::Spawn (unsigned int num_threads)   Start processing threads. More...
  void  CPoolOfThreads_ForServer::AcceptRequest (const TRequest &request)   Put a request in the queue with a given priority. More...
  TItemHandle  CPoolOfThreads_ForServer::GetHandle (void)   void  CPoolOfThreads_ForServer::KillAllThreads (bool wait)   Causes all threads in the pool to exit cleanly after finishing all pending requests, optionally waiting for them to die. More...
  TThreadCPoolOfThreads_ForServer::NewThread (void)   Create a new thread. More...
  bool  CPoolOfThreads_ForServer::Register (TThread &thread)   Register a thread. More...
  void  CPoolOfThreads_ForServer::UnRegister (TThread &)   Unregister a thread. More...
    CThreadPool_Task::CThreadPool_Task (unsigned int priority=0)   Constructor. More...
  virtual EStatus  CThreadPool_Task::Execute (void)=0   Do the actual job. More...
  void  CThreadPool_Task::RequestToCancel (void)   Cancel the task. More...
  bool  CThreadPool_Task::IsCancelRequested (void) const   Check if cancellation of the task was requested. More...
  EStatus  CThreadPool_Task::GetStatus (void) const   Get status of the task. More...
  bool  CThreadPool_Task::IsFinished (void) const   Check if task execution has been already finished (successfully or not) More...
  unsigned int  CThreadPool_Task::GetPriority (void) const   Get priority of the task. More...
  virtual void  CThreadPool_Task::OnStatusChange (EStatus old)   Callback to notify on changes in the task status. More...
  virtual void  CThreadPool_Task::OnCancelRequested (void)   Callback to notify when cancellation of the task is requested. More...
    CThreadPool_Task::CThreadPool_Task (const CThreadPool_Task &other)   Copy ctor. More...
  CThreadPool_TaskCThreadPool_Task::operator= (const CThreadPool_Task &other)   Assignment. More...
  CThreadPoolCThreadPool_Task::GetPool (void) const   The thread pool which accepted this task for execution. More...
  virtual  CThreadPool_Task::~CThreadPool_Task (void)   Destructor. Will be called from CRef. More...
  void  CThreadPool_Task::x_Init (unsigned int priority)   Init all members in constructor. More...
  void  CThreadPool_Task::x_SetOwner (CThreadPool_Impl *pool)   Set pool as owner of this task. More...
  void  CThreadPool_Task::x_ResetOwner (void)   Detach task from the pool (if insertion into the pool has failed). More...
  void  CThreadPool_Task::x_SetStatus (EStatus new_status)   Set task status. More...
  void  CThreadPool_Task::x_RequestToCancel (void)   Internal canceling of the task. More...
    CThreadPool::CThreadPool (unsigned int queue_size, unsigned int max_threads, unsigned int min_threads=2, CThread::TRunMode threads_mode=CThread::fRunDefault)   Constructor. More...
  void  CThreadPool::AddTask (CThreadPool_Task *task, const CTimeSpan *timeout=NULL)   Add task to the pool for execution. More...
  void  CThreadPool::CancelTask (CThreadPool_Task *task)   Request to cancel the task and remove it from queue if it is there. More...
  virtual  CThreadPool::~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  CThreadPool::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::CThreadPool (unsigned int queue_size, CThreadPool_Controller *controller, CThread::TRunMode threads_mode=CThread::fRunDefault)   Constructor with custom controller. More...
  void  CThreadPool::SetDestroyTimeout (const CTimeSpan &timeout)   Set timeout to wait for all threads to finish before the pool should be able to destroy. More...
  const CTimeSpanCThreadPool::GetDestroyTimeout (void) const   Get timeout to wait for all threads to finish before the pool will be able to destroy. More...
  void  CThreadPool::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  CThreadPool::CancelTasks (TExclusiveFlags tasks_group)   Cancel the selected groups of tasks in the pool. More...
  void  CThreadPool::FlushThreads (EFlushType flush_type)   Finish all current threads and replace them with new ones. More...
  unsigned int  CThreadPool::GetThreadsCount (void) const   Get total number of threads currently running in pool. More...
  unsigned int  CThreadPool::GetQueuedTasksCount (void) const   Get the number of tasks currently waiting in queue. More...
  unsigned int  CThreadPool::GetExecutingTasksCount (void) const   Get the number of currently executing tasks. More...
  bool  CThreadPool::IsAborted (void) const   Does method Abort() was already called for this ThreadPool. More...
  virtual CThreadPool_ThreadCThreadPool::CreateThread (void)   Create new thread for the pool. More...
  CMutexCThreadPool::GetMainPoolMutex (void)   Get the mutex that protects all changes in the pool. More...
    CThreadPool::CThreadPool (const CThreadPool &)   Prohibit copying and assigning. More...
  CThreadPoolCThreadPool::operator= (const CThreadPool &)   CRef< CThreadPool_TaskCThreadPool_Thread::GetCurrentTask (void) const   Get the task currently executing in the thread. More...
    CThreadPool_Thread::CThreadPool_Thread (CThreadPool *pool)   Construct and attach to the pool. More...
  virtual  CThreadPool_Thread::~CThreadPool_Thread (void)   Destructor. More...
  virtual void  CThreadPool_Thread::Initialize (void)   Init this thread. It is called at beginning of Main() More...
  virtual void  CThreadPool_Thread::Finalize (void)   Clean up. It is called by OnExit() More...
  CThreadPoolCThreadPool_Thread::GetPool (void) const   Get the thread pool in which this thread is running. More...
    CThreadPool_Thread::CThreadPool_Thread (const CThreadPool_Thread &)   Prohibit copying and assigning. More...
  CThreadPool_ThreadCThreadPool_Thread::operator= (const CThreadPool_Thread &)   virtual void *  CThreadPool_Thread::Main (void)   To prevent overriding - main thread function. More...
  virtual void  CThreadPool_Thread::OnExit (void)   To prevent overriding - do cleanup after exiting from thread. More...
    CThreadPool_Controller::CThreadPool_Controller (unsigned int max_threads, unsigned int min_threads)   Constructor. More...
  void  CThreadPool_Controller::SetMinThreads (unsigned int min_threads)   Set the minimum number of threads in pool. More...
  unsigned int  CThreadPool_Controller::GetMinThreads (void) const   Get the minimum number of threads in pool. More...
  void  CThreadPool_Controller::SetMaxThreads (unsigned int max_threads)   Set the maximum number of threads in pool. More...
  unsigned int  CThreadPool_Controller::GetMaxThreads (void) const   Get the maximum number of threads in pool. More...
  void  CThreadPool_Controller::HandleEvent (EEvent event)   This method is called every time something happens in a pool, such as: new task added, task is started or finished execution, new threads started or some threads finished. More...
  virtual CTimeSpan  CThreadPool_Controller::GetSafeSleepTime (void) const   Get maximum timeout for which calls to method HandleEvent() can be missing. More...
  virtual  CThreadPool_Controller::~CThreadPool_Controller (void)   Destructor. Have to be called only from CRef. More...
  virtual void  CThreadPool_Controller::OnEvent (EEvent event)=0   Main method for the implementation of controlling algorithm. More...
  CThreadPoolCThreadPool_Controller::GetPool (void) const   Get pool to which this class is attached. More...
  CMutexCThreadPool_Controller::GetMainPoolMutex (CThreadPool *pool) const   Get mutex which guards access to pool All work in controller should be based on the same mutex as in pool. More...
  void  CThreadPool_Controller::EnsureLimits (void)   Ensure that constraints of minimum and maximum count of threads in pool are met. More...
  void  CThreadPool_Controller::SetThreadsCount (unsigned int count)   Set number of threads in pool Adjust given number to conform to minimum and maximum threads count constraints if needed. More...
    CThreadPool_Controller::CThreadPool_Controller (const CThreadPool_Controller &)   Prohibit copying and assigning. More...
  CThreadPool_ControllerCThreadPool_Controller::operator= (const CThreadPool_Controller &)   void  CThreadPool_Controller::x_AttachToPool (CThreadPool_Impl *pool)   Attach the controller to ThreadPool. More...
  void  CThreadPool_Controller::x_DetachFromPool (void)   Detach the controller from pool when pool is aborted. More...
  virtual const char *  CThreadPoolException::GetErrCodeString (void) const override   Get error code interpreted as text. More...
    CThreadPoolException::NCBI_EXCEPTION_DEFAULT (CThreadPoolException, CException)     SThreadPool_PID_ErrInfo::SThreadPool_PID_ErrInfo (double time_, double err_)     CThreadPool_Controller_PID::CThreadPool_Controller_PID (unsigned int max_threads, unsigned int min_threads)   Constructor. More...
  void  CThreadPool_Controller_PID::SetQueuedTasksThreshold (double threshold)   Set maximum number of tasks in queue per each thread The meaning of parameter is only approximate. More...
  double  CThreadPool_Controller_PID::GetQueuedTasksThreshold (void)   Get maximum number of tasks in queue per each thread. More...
  void  CThreadPool_Controller_PID::SetTaskMaxQueuedTime (double queued_time)   Set maximum time (in seconds) that task can wait in queue for processing until new thread will be launched. More...
  double  CThreadPool_Controller_PID::GetTaskMaxQueuedTime (void)   Get maximum time that task can wait in queue for processing until new thread will be launched. More...
  void  CThreadPool_Controller_PID::SetChangeCalcTime (double calc_time)   Set the time period (in seconds) for which average speed of changing of waiting tasks number is calculated. More...
  double  CThreadPool_Controller_PID::GetChangeCalcTime (void)   Get the time period for which average speed of changing of waiting tasks number is calculated. More...
  void  CThreadPool_Controller_PID::SetChangePredictTime (double predict_time)   Set period of prediction of number of tasks in queue The meaning of parameter is only approximate. More...
  double  CThreadPool_Controller_PID::GetChangePredictTime (void)   Get period of prediction of number of tasks in queue. More...
  virtual CTimeSpan  CThreadPool_Controller_PID::GetSafeSleepTime (void) const   Get maximum timeout for which calls to method HandleEvent() can be missing. More...
  virtual void  CThreadPool_Controller_PID::OnEvent (EEvent event)   Main method for implementation of controlling algorithm. More...
    CQueueItemBase::CQueueItemBase (TPriority priority)   bool  CQueueItemBase::operator> (const CQueueItemBase &item) const   const TPriorityCQueueItemBase::GetPriority (void) const   const EStatusCQueueItemBase::GetStatus (void) const   TUserPriority  CQueueItemBase::GetUserPriority (void) const   void  CQueueItemBase::MarkAsComplete (void)   void  CQueueItemBase::MarkAsForciblyCaught (void)   virtual void  CQueueItemBase::x_SetStatus (EStatus new_status)     CBlockingQueue< TRequest >::CCompletingHandle::CCompletingHandle (const TItemHandle &h)     CBlockingQueue< TRequest >::CCompletingHandle::~CCompletingHandle ()     CBlockingQueue< TRequest >::CBlockingQueue (size_t max_size=kMax_UInt)   Constructor. More...
  TItemHandle  CBlockingQueue< TRequest >::Put (const TRequest &request, TUserPriority priority=0, unsigned int timeout_sec=0, unsigned int timeout_nsec=0)   Put a request into the queue. More...
  void  CBlockingQueue< TRequest >::WaitForRoom (unsigned int timeout_sec=kMax_UInt, unsigned int timeout_nsec=0) const   Wait for room in the queue for up to timeout_sec + timeout_nsec/1E9 seconds. More...
  void  CBlockingQueue< TRequest >::WaitForHunger (unsigned int timeout_sec=kMax_UInt, unsigned int timeout_nsec=0) const   Wait for the queue to have waiting readers, for up to timeout_sec + timeout_nsec/1E9 seconds. More...
  TItemHandle  CBlockingQueue< TRequest >::GetHandle (unsigned int timeout_sec=kMax_UInt, unsigned int timeout_nsec=0)   Get the first available request from the queue, and return a handle to it. More...
  TRequest  CBlockingQueue< TRequest >::Get (unsigned int timeout_sec=kMax_UInt, unsigned int timeout_nsec=0)   Get the first available request from the queue, and return just the request. More...
  size_t  CBlockingQueue< TRequest >::GetSize (void) const   Get the number of requests in the queue. More...
  size_t  CBlockingQueue< TRequest >::GetMaxSize (void) const   Get the maximun number of requests that can be put into the queue. More...
  bool  CBlockingQueue< TRequest >::IsEmpty (void) const   Check if the queue is empty. More...
  bool  CBlockingQueue< TRequest >::IsFull (void) const   Check if the queue is full. More...
  void  CBlockingQueue< TRequest >::SetUserPriority (TItemHandle handle, TUserPriority priority)   Adjust a pending request's priority. More...
  void  CBlockingQueue< TRequest >::Withdraw (TItemHandle handle)   Withdraw a pending request from consideration. More...
  size_t  CBlockingQueue< TRequest >::GetHunger (void) const   Get the number of threads waiting for requests, for debugging purposes only. More...
    CBlockingQueue< TRequest >::CQueueItem::CQueueItem (Uint4 priority, TRequest request)   const TRequest &  CBlockingQueue< TRequest >::CQueueItem::GetRequest (void) const   TRequest &  CBlockingQueue< TRequest >::CQueueItem::SetRequest (void)   void  CBlockingQueue< TRequest >::CQueueItem::x_SetStatus (EStatus new_status)   bool  CBlockingQueue< TRequest >::SItemHandleGreater::operator() (const TItemHandle &i1, const TItemHandle &i2) const   bool  CBlockingQueue< TRequest >::x_GetSemPred (const TRealQueue &q) const   bool  CBlockingQueue< TRequest >::x_PutSemPred (const TRealQueue &q) const   bool  CBlockingQueue< TRequest >::x_HungerSemPred (const TRealQueue &q) const   bool  CBlockingQueue< TRequest >::x_WaitForPredicate (TQueuePredicate pred, CSemaphore &sem, CMutexGuard &guard, unsigned int timeout_sec, unsigned int timeout_nsec) const     CBlockingQueue< TRequest >::CBlockingQueue (const CBlockingQueue &)   forbidden More...
  CBlockingQueueCBlockingQueue< TRequest >::operator= (const CBlockingQueue &)     CThreadInPool< TRequest >::CThreadInPool (TPool *pool, ERunMode mode=eNormal)   Constructor. More...
  void  CThreadInPool< TRequest >::CountSelf (CAtomicCounter *counter)   virtual  CThreadInPool< TRequest >::~CThreadInPool (void)   Destructor. More...
  virtual void  CThreadInPool< TRequest >::Init (void)   Intit this thread. It is called at beginning of Main() More...
  virtual void  CThreadInPool< TRequest >::ProcessRequest (TItemHandle handle)   Process a request. More...
  virtual void  CThreadInPool< TRequest >::ProcessRequest (const TRequest &req)=0   Older interface (still delegated to by default) More...
  virtual void  CThreadInPool< TRequest >::x_OnExit (void)   Clean up. It is called by OnExit() More...
  ERunMode  CThreadInPool< TRequest >::GetRunMode (void) const   Get run mode. More...
  virtual void *  CThreadInPool< TRequest >::Main (void)   Derived (user-created) class must provide a real thread function. More...
  virtual void  CThreadInPool< TRequest >::OnExit (void)   Override this to execute finalization code. More...
  void  CThreadInPool< TRequest >::x_HandleOneRequest (bool catch_all)   void  CThreadInPool< TRequest >::x_UnregisterThread (void)     CThreadInPool< TRequest >::CAutoUnregGuard::CAutoUnregGuard (TThread *thr)     CThreadInPool< TRequest >::CAutoUnregGuard::~CAutoUnregGuard (void)     CPoolOfThreads< TRequest >::CPoolOfThreads (unsigned int max_threads, unsigned int queue_size, unsigned int spawn_threshold=1, unsigned int max_urgent_threads=kMax_UInt, const string &thread_name=kEmptyStr)   Constructor. More...
  virtual  CPoolOfThreads< TRequest >::~CPoolOfThreads (void)   Destructor. More...
  void  CPoolOfThreads< TRequest >::Spawn (unsigned int num_threads)   Start processing threads. More...
  TItemHandle  CPoolOfThreads< TRequest >::AcceptRequest (const TRequest &request, TUserPriority priority=0, unsigned int timeout_sec=0, unsigned int timeout_nsec=0)   Put a request in the queue with a given priority. More...
  TItemHandle  CPoolOfThreads< TRequest >::AcceptUrgentRequest (const TRequest &request, unsigned int timeout_sec=0, unsigned int timeout_nsec=0)   Puts a request in the queue with the highest priority It will run a new thread even if the maximum of allowed threads has been already reached. More...
  void  CPoolOfThreads< TRequest >::WaitForRoom (unsigned int timeout_sec=kMax_UInt, unsigned int timeout_nsec=0)   Wait for the room in the queue up to timeout_sec + timeout_nsec/1E9 seconds. More...
  bool  CPoolOfThreads< TRequest >::IsFull (void) const   Check if the queue is full. More...
  bool  CPoolOfThreads< TRequest >::IsEmpty (void) const   Check if the queue is empty. More...
  bool  CPoolOfThreads< TRequest >::HasImmediateRoom (bool urgent=false) const   Check whether a new request could be immediately processed. More...
  void  CPoolOfThreads< TRequest >::SetUserPriority (TItemHandle handle, TUserPriority priority)   Adjust a pending request's priority. More...
  void  CPoolOfThreads< TRequest >::Withdraw (TItemHandle handle)   Withdraw a pending request from consideration. More...
  size_t  CPoolOfThreads< TRequest >::GetQueueSize (void) const   Get the number of requests in the queue. More...
  virtual TThreadCPoolOfThreads< TRequest >::NewThread (ERunMode mode)=0   Create a new thread. More...
  virtual void  CPoolOfThreads< TRequest >::Register (TThread &thread)   Register a thread. More...
  virtual void  CPoolOfThreads< TRequest >::UnRegister (TThread &)   Unregister a thread. More...
  TItemHandle  CPoolOfThreads< TRequest >::x_AcceptRequest (const TRequest &req, TUserPriority priority, bool urgent, unsigned int timeout_sec=0, unsigned int timeout_nsec=0)   void  CPoolOfThreads< TRequest >::x_RunNewThread (ERunMode mode, CAtomicCounter *counter)   virtual  CStdRequest::~CStdRequest (void)   Destructor. More...
  virtual void  CStdRequest::Process (void)=0   Do the actual job Called by whichever thread handles this request. More...
  virtual void  CStdRequest::OnStatusChange (EStatus, EStatus)   Callback for status changes. More...
    CStdThreadInPool::CStdThreadInPool (TPool *pool, ERunMode mode=eNormal)   Constructor. More...
  virtual void  CStdThreadInPool::ProcessRequest (const CRef< CStdRequest > &req)   Process a request. More...
  virtual void  CStdThreadInPool::ProcessRequest (TItemHandle handle)     CStdPoolOfThreads::CStdPoolOfThreads (unsigned int max_threads, unsigned int queue_size, unsigned int spawn_threshold=1, unsigned int max_urgent_threads=kMax_UInt, const string &thread_name=kEmptyStr)   Constructor. More...
  virtual  CStdPoolOfThreads::~CStdPoolOfThreads ()   virtual void  CStdPoolOfThreads::KillAllThreads (TKillFlags flags)   Causes all threads in the pool to exit cleanly after finishing all pending requests, optionally waiting for them to die. More...
  virtual void  CStdPoolOfThreads::KillAllThreads (bool wait)   Causes all threads in the pool to exit cleanly after finishing all pending requests, optionally waiting for them to die. More...
  virtual void  CStdPoolOfThreads::Register (TThread &thread)   Register a thread. More...
  virtual void  CStdPoolOfThreads::UnRegister (TThread &thread)   Unregister a thread. More...
  virtual TThreadCStdPoolOfThreads::NewThread (TThread::ERunMode mode)   Create a new thread. More...
    NCBI_PARAM_DECL (bool, ThreadPool, Catch_Unhandled_Exceptions)   typedef  NCBI_PARAM_TYPE (ThreadPool, Catch_Unhandled_Exceptions) TParamThreadPoolCatchExceptions   ◆ ERunMode ◆ EStatus [1/2] ◆ EStatus [2/2] ◆ TACValue [1/2] ◆ TACValue [2/2] ◆ TCompletingHandle [1/2] ◆ TCompletingHandle [2/2] ◆ TExclusiveFlags ◆ TItemHandle [1/6] ◆ TItemHandle [2/6] ◆ TItemHandle [3/6] ◆ TItemHandle [4/6] ◆ TItemHandle [5/6] ◆ TItemHandle [6/6] ◆ TKillFlags ◆ TParent [1/2] ◆ TParent [2/2] ◆ TPool [1/2] ◆ TPool [2/2] ◆ TPriority [1/2]

Every request has an associated 32-bit priority field, but only the top eight bits are under direct user control.

(The rest are a counter.)

Definition at line 81 of file thread_pool_old.hpp.

◆ TPriority [2/2] ◆ TQueue [1/2] ◆ TQueue [2/2] ◆ TQueuePredicate ◆ TRealQueue [1/2] ◆ TRealQueue [2/2]

template<typename TRequest >

◆ TRequest [1/3] ◆ TRequest [2/3] ◆ TRequest [3/3] ◆ TThread [1/4] ◆ TThread [2/4] ◆ TThread [3/4] ◆ TThread [4/4] ◆ TThreads [1/2] ◆ TThreads [2/2] ◆ TUserPriority [1/3] ◆ TUserPriority [2/3] ◆ TUserPriority [3/3] ◆ EErrCode Enumerator eControllerBusy 

attempt to create several ThreadPools with the same controller

eTaskBusy 

attempt to change task when it's already placed into ThreadPool or to put task in ThreadPool several times

eProhibited 

attempt to do something when ThreadPool was already aborted or to add task when it is prohibited by flags of exclusive execution

eInactive 

attempt to call active methods in ThreadPool_Controller when it is not attached to any ThreadPool

eInvalid 

attempt to operate task added in one ThreadPool by means of methods of another ThreadPool or invalid parameters in the constructor

Definition at line 606 of file thread_pool.hpp.

◆ EEvent

Events that can happen with ThreadPool.

Enumerator eSuspend 

ThreadPool is suspended for exclusive task execution.

eResume 

ThreadPool is resumed after exclusive task execution.

eOther 

All other events (happen asynchronously, so cannot be further distinguished)

Definition at line 513 of file thread_pool.hpp.

◆ EExclusiveFlags

Binary flags indicating different possible options in what environment the pool will execute exclusive task.

See also
TExclusiveFlags, RequestExclusiveExecution()
Enumerator fDoNotAllowNewTasks 

Do not allow to add new tasks to the pool during exclusive task execution.

fFlushThreads 

Finish all threads currently running in the pool.

fCancelExecutingTasks 

Cancel all currently executing tasks.

fCancelQueuedTasks 

Cancel all tasks waiting in the queue and not yet executing.

fExecuteQueuedTasks 

Execute all tasks waiting in the queue before execution of exclusive task.

Definition at line 333 of file thread_pool.hpp.

◆ EFlushType

When to start new threads after flushing old ones.

See also
FlushThreads()
Enumerator eStartImmediately 

New threads can be started immediately.

eWaitToFinish 

New threads can be started only when all old threads finished their execution.

Definition at line 381 of file thread_pool.hpp.

◆ EKillFlags Enumerator fKill_Wait 

Wait for all threads in the pool to finish.

fKill_Reopen 

Allow a fresh batch of worker threads.

Definition at line 633 of file thread_pool_old.hpp.

◆ ERunMode

template<typename TRequest >

Thread run mode.

Enumerator eNormal 

Process request and stay in the pool.

eRunOnce 

Process request and die.

Definition at line 314 of file thread_pool_old.hpp.

◆ EStatus [1/2]

Status of the task.

Enumerator eIdle 

has not been placed in queue yet

eQueued 

in the queue, awaiting execution

eExecuting 

being executed

eCompleted 

executed successfully

eFailed 

failure during execution

eCanceled 

canceled - possible only if canceled before processing was started or if method Execute() returns result eCanceled

Definition at line 79 of file thread_pool.hpp.

◆ EStatus [2/2] Enumerator ePending 

still in the queue

eActive 

extracted but not yet released

eComplete 

extracted and released

eWithdrawn 

dropped by submitter's request

eForciblyCaught 

let an exception escape

Definition at line 70 of file thread_pool_old.hpp.

◆ Abort() ◆ AcceptRequest() [1/2] void CPoolOfThreads_ForServer::AcceptRequest ( const TRequestrequest ) ◆ AcceptRequest() [2/2]

template<typename TRequest >

◆ AcceptUrgentRequest()

template<typename TRequest >

Puts a request in the queue with the highest priority It will run a new thread even if the maximum of allowed threads has been already reached.

Parameters

Definition at line 1104 of file thread_pool_old.hpp.

◆ AddTask() ◆ CancelTask() ◆ CancelTasks() ◆ CAutoUnregGuard() [1/2] CThreadInPool_ForServer::CAutoUnregGuard::CAutoUnregGuard ( TThreadthr )

Definition at line 154 of file server.cpp.

◆ CAutoUnregGuard() [2/2] ◆ CBlockingQueue() [1/2]

template<typename TRequest >

forbidden

◆ CBlockingQueue() [2/2]

template<typename TRequest >

Constructor.

Parameters
max_size The maximum size of the queue (may not be zero!)

Definition at line 142 of file thread_pool_old.hpp.

◆ CBlockingQueue_ForServer() [1/2] ◆ CBlockingQueue_ForServer() [2/2] CBlockingQueue_ForServer::CBlockingQueue_ForServer ( void  ) inline ◆ CCompletingHandle() [1/2] ◆ CCompletingHandle() [2/2] ◆ CountSelf() [1/2]

template<typename TRequest >

◆ CountSelf() [2/2] void CThreadInPool_ForServer::CountSelf ( void  ) ◆ CPoolOfThreads()

template<typename TRequest >

Constructor.

Parameters
max_threads The maximum number of threads that this pool can run queue_size The maximum number of requests in the queue spawn_threashold The number of requests in the queue after which a new thread is started max_urgent_threads The maximum number of urgent threads running simultaneously

Definition at line 1055 of file thread_pool_old.hpp.

◆ CPoolOfThreads_ForServer() CPoolOfThreads_ForServer::CPoolOfThreads_ForServer ( unsigned int  max_threads, const stringthr_suffix  ) ◆ CQueueItem() [1/2] ◆ CQueueItem() [2/2] ◆ CQueueItemBase() ◆ CQueueItemBase_ForServer() ◆ CreateThread() ◆ CStdPoolOfThreads() CStdPoolOfThreads::CStdPoolOfThreads ( unsigned int  max_threads, unsigned int  queue_size, unsigned int  spawn_threshold = 1, unsigned int  max_urgent_threads = kMax_UInt, const stringthread_name = kEmptyStr  ) inline

Constructor.

Parameters
max_threads The maximum number of threads that this pool can run queue_size The maximum number of requests in the queue spawn_threshold The number of requests in the queue after which a new thread is started max_urgent_threads The maximum number of urgent threads running simultaneously

Definition at line 623 of file thread_pool_old.hpp.

◆ CStdThreadInPool()

Constructor.

Parameters
pool A pool where this thead is placed mode A running mode of this thread

Definition at line 586 of file thread_pool_old.hpp.

◆ CThreadInPool()

template<typename TRequest >

Constructor.

Parameters
pool A pool where this thead is placed mode A running mode of this thread

Definition at line 325 of file thread_pool_old.hpp.

◆ CThreadInPool_ForServer() CThreadInPool_ForServer::CThreadInPool_ForServer ( TPoolpool ) inline

Constructor.

Parameters
pool A pool where this thead is placed mode A running mode of this thread

Definition at line 166 of file thread_pool_for_server.hpp.

◆ CThreadPool() [1/3]

Prohibit copying and assigning.

◆ CThreadPool() [2/3]

Constructor with custom controller.

Parameters
queue_size Maximum number of tasks waiting in the queue. If 0 then tasks cannot be queued and are added only when there are threads to process them. If greater than 0 and there will be attempt to add new task over this maximum then method AddTask() will wait for the given timeout for some empty space in the queue. controller Custom controller object that will be responsible for number of threads in the pool, when new threads have to be launched and old and unused threads have to be finished. Default controller implementation (set for the pool in case of using other constructor) is CThreadPool_Controller_PID class. threads_mode Running mode of all threads in thread pool. Values fRunDetached and fRunAllowST are ignored.

Definition at line 2187 of file thread_pool.cpp.

References CThreadPool::CThreadPool_Impl, CThreadPool::m_Impl, and CThreadPool_Impl::SetInterfaceStarted().

◆ CThreadPool() [3/3]

Constructor.

Parameters
queue_size Maximum number of tasks waiting in the queue. If 0 then tasks cannot be queued and are added only when there are threads to process them. If greater than 0 and there will be attempt to add new task over this maximum then method AddTask() will wait for the given timeout for some empty space in the queue. max_threads Maximum number of threads allowed to be launched in the pool. Value cannot be less than min_threads or equal to 0. min_threads Minimum number of threads that have to be launched even if there are no tasks added. Value cannot be greater than max_threads. threads_mode Running mode of all threads in thread pool. Values fRunDetached and fRunAllowST are ignored.
See also
AddTask()

Definition at line 2177 of file thread_pool.cpp.

References CThreadPool::CThreadPool_Impl, CThreadPool::m_Impl, and CThreadPool_Impl::SetInterfaceStarted().

◆ CThreadPool_Controller() [1/2]

Prohibit copying and assigning.

◆ CThreadPool_Controller() [2/2] CThreadPool_Controller::CThreadPool_Controller ( unsigned int  max_threads, unsigned int  min_threads  )

Constructor.

Parameters
max_threads Maximum number of threads in pool min_threads Minimum number of threads in pool

Definition at line 1995 of file thread_pool.cpp.

References NCBI_THROW_FMT.

◆ CThreadPool_Controller_PID() CThreadPool_Controller_PID::CThreadPool_Controller_PID ( unsigned int  max_threads, unsigned int  min_threads  ) ◆ CThreadPool_Task() [1/2] ◆ CThreadPool_Task() [2/2] CThreadPool_Task::CThreadPool_Task ( unsigned int  priority = 0 ) ◆ CThreadPool_Thread() [1/2]

Prohibit copying and assigning.

◆ CThreadPool_Thread() [2/2] CThreadPool_Thread::CThreadPool_Thread ( CThreadPoolpool ) protected ◆ EnsureLimits() void CThreadPool_Controller::EnsureLimits ( void  ) protected ◆ Execute() virtual EStatus CThreadPool_Task::Execute ( void  ) pure virtual

Do the actual job.

Called by whichever thread handles this task.

Returns
Result of task execution (the status will be set accordingly)
Note
Only 3 values are allowed: eCompleted, eFailed, eCanceled.

Implemented in SAsyncWriteTask, CWGSThreadPoolTask_GetChunk, CWGSThreadPoolTask_GetBlobByBlobId, CWGSThreadPoolTask_GetBlobBySeqId, CWGSThreadPoolTask_ResolveSeqId, CSNPThreadPoolTask_GetAnnotation, CSNPThreadPoolTask_GetChunk, CSNPThreadPoolTask_GetBlobByBlobId, CCDDThreadPoolTask_GetBlobByBlobId, CCDDThreadPoolTask_GetBlobBySeqId, CCDDThreadPoolTask_GetBlobId, CThreadPool_EmptyTask, CCreateCoverageTask, CPrefetchRequest, CThreadPoolEngine::CThreadTask, and CPSGL_RequestTracker::CBackgroundTask.

Referenced by CThreadPool_ThreadImpl::Main(), and CThreadPool_ServiceThread::Main().

◆ Finalize() void CThreadPool_Thread::Finalize ( void  ) protectedvirtual ◆ FlushThreads() void CThreadPool::FlushThreads ( EFlushType  flush_type ) ◆ Get()

template<typename TRequest >

Get the first available request from the queue, and return just the request.

Blocks politely if empty. Waits up to timeout_sec + timeout_nsec/1E9 seconds.

Parameters
timeout_sec Number of seconds timeout_nsec Number of nanoseconds

Definition at line 815 of file thread_pool_old.hpp.

◆ GetChangeCalcTime() double CThreadPool_Controller_PID::GetChangeCalcTime ( void  ) inline ◆ GetChangePredictTime() double CThreadPool_Controller_PID::GetChangePredictTime ( void  ) inline ◆ GetCurrentTask() ◆ GetDestroyTimeout()

Get timeout to wait for all threads to finish before the pool will be able to destroy.

Note
This method is meant to be called very rarely. Because of that it is implemented in non-threadsafe manner. While this method is working (and after that if timeout is stored in some variable as reference) it is not allowed to call SetDestroyTimeout() in other threads.

Definition at line 2243 of file thread_pool.cpp.

References CThreadPool_Impl::GetDestroyTimeout(), and CThreadPool::m_Impl.

◆ GetErrCodeString() const char * CThreadPoolException::GetErrCodeString ( void  ) const overridevirtual ◆ GetExecutingTasksCount() unsigned int CThreadPool::GetExecutingTasksCount ( void  ) const ◆ GetHandle() [1/3]

template<typename TRequest >

Get the first available request from the queue, and return a handle to it.

Blocks politely if empty. Waits up to timeout_sec + timeout_nsec/1E9 seconds.

Parameters
timeout_sec Number of seconds timeout_nsec Number of nanoseconds

Definition at line 767 of file thread_pool_old.hpp.

References _VERIFY, set< Key, Compare >::begin(), set< Key, Compare >::empty(), set< Key, Compare >::erase(), NCBI_THROW, ok, CGuard< Resource, Lock, Unlock, ReportExceptions >::Release(), set< Key, Compare >::size(), and CBlockingQueue< TRequest >::x_GetSemPred().

Referenced by CSeqFetchQueue::Clear(), and CThreadInPool< TRequest >::x_HandleOneRequest().

◆ GetHandle() [2/3] ◆ GetHandle() [3/3] ◆ GetHunger()

template<typename TRequest >

Get the number of threads waiting for requests, for debugging purposes only.

Definition at line 229 of file thread_pool_old.hpp.

◆ GetMainPoolMutex() [1/2] ◆ GetMainPoolMutex() [2/2] CMutex & CThreadPool::GetMainPoolMutex ( void  ) protected ◆ GetMaxSize()

template<typename TRequest >

◆ GetMaxThreads() unsigned int CThreadPool_Controller::GetMaxThreads ( void  ) const inline ◆ GetMinThreads() unsigned int CThreadPool_Controller::GetMinThreads ( void  ) const inline ◆ GetPool() [1/3] ◆ GetPool() [2/3] CThreadPool * CThreadPool_Thread::GetPool ( void  ) const protected ◆ GetPool() [3/3] CThreadPool * CThreadPool_Controller::GetPool ( void  ) const protected ◆ GetPriority() [1/2] unsigned int CThreadPool_Task::GetPriority ( void  ) const inline ◆ GetPriority() [2/2] ◆ GetQueuedTasksCount() unsigned int CThreadPool::GetQueuedTasksCount ( void  ) const ◆ GetQueuedTasksThreshold() double CThreadPool_Controller_PID::GetQueuedTasksThreshold ( void  ) inline ◆ GetQueueSize()

template<typename TRequest >

◆ GetRequest() [1/2] const TRequest& CBlockingQueue_ForServer::CQueueItem::GetRequest ( void  ) const inline ◆ GetRequest() [2/2] ◆ GetRunMode()

template<typename TRequest >

◆ GetSafeSleepTime() [1/2] CTimeSpan CThreadPool_Controller::GetSafeSleepTime ( void  ) const virtual ◆ GetSafeSleepTime() [2/2] CTimeSpan CThreadPool_Controller_PID::GetSafeSleepTime ( void  ) const virtual ◆ GetSize()

template<typename TRequest >

◆ GetStatus() [1/3] const EStatus& CQueueItemBase_ForServer::GetStatus ( void  ) const inline ◆ GetStatus() [2/3] ◆ GetStatus() [3/3] ◆ GetTaskMaxQueuedTime() double CThreadPool_Controller_PID::GetTaskMaxQueuedTime ( void  ) inline ◆ GetThreadsCount() unsigned int CThreadPool::GetThreadsCount ( void  ) const ◆ GetUserPriority() ◆ HandleEvent() void CThreadPool_Controller::HandleEvent ( EEvent  event ) ◆ HasImmediateRoom()

template<typename TRequest >

◆ Init()

template<typename TRequest >

◆ Initialize() void CThreadPool_Thread::Initialize ( void  ) protectedvirtual ◆ IsAborted() bool CThreadPool::IsAborted ( void  ) const ◆ IsCancelRequested() bool CThreadPool_Task::IsCancelRequested ( void  ) const inline ◆ IsEmpty() [1/2]

template<typename TRequest >

◆ IsEmpty() [2/2]

template<typename TRequest >

◆ IsFinished() bool CThreadPool_Task::IsFinished ( void  ) const inline ◆ IsFull() [1/2]

template<typename TRequest >

◆ IsFull() [2/2]

template<typename TRequest >

◆ KillAllThreads() [1/3] void CPoolOfThreads_ForServer::KillAllThreads ( bool  wait ) ◆ KillAllThreads() [2/3] virtual void CStdPoolOfThreads::KillAllThreads ( bool  wait ) inlinevirtual ◆ KillAllThreads() [3/3] void CStdPoolOfThreads::KillAllThreads ( TKillFlags  flags ) virtual

Causes all threads in the pool to exit cleanly after finishing all pending requests, optionally waiting for them to die.

Parameters
flags Governs optional behavior

Definition at line 51 of file thread_pool_old.cpp.

References CPoolOfThreads< CRef< CStdRequest > >::AcceptRequest(), ERR_POST, CStdPoolOfThreads::fKill_Reopen, CStdPoolOfThreads::fKill_Wait, flags, CAtomicCounter::Get(), i, CPoolOfThreads< CRef< CStdRequest > >::m_MaxThreads, CPoolOfThreads< CRef< CStdRequest > >::m_Mutex, CPoolOfThreads< CRef< CStdRequest > >::m_QueuingForbidden, CPoolOfThreads< CRef< CStdRequest > >::m_ThreadCount, CStdPoolOfThreads::m_Threads, n, NON_CONST_ITERATE, CAtomicCounter::Set(), CPoolOfThreads< CRef< CStdRequest > >::WaitForRoom(), and Warning().

Referenced by CSeqFetchQueue::Finish(), CStdPoolOfThreads::KillAllThreads(), SGridWorkerNodeImpl::x_StopWorkerThreads(), and CStdPoolOfThreads::~CStdPoolOfThreads().

◆ Main() [1/3] void * CThreadInPool_ForServer::Main ( void  ) privatevirtual ◆ Main() [2/3] void * CThreadPool_Thread::Main ( void  ) privatevirtual ◆ Main() [3/3]

template<typename TRequest >

Derived (user-created) class must provide a real thread function.

Implements CThread.

Definition at line 1003 of file thread_pool_old.hpp.

References _ASSERT, ERR_POST, CThreadInPool< TRequest >::eRunOnce, CThreadInPool< TRequest >::Init(), CThreadInPool< TRequest >::m_Pool, CThreadInPool< TRequest >::m_RunMode, CPoolOfThreads< TRequest >::m_ThreadName, CPoolOfThreads< TRequest >::Register(), CThread::SetCurrentThreadName(), Warning(), and CThreadInPool< TRequest >::x_HandleOneRequest().

◆ MarkAsComplete() [1/2] void CQueueItemBase_ForServer::MarkAsComplete ( void  ) inline ◆ MarkAsComplete() [2/2] void CQueueItemBase::MarkAsComplete ( void  ) inline ◆ MarkAsForciblyCaught() [1/2] void CQueueItemBase_ForServer::MarkAsForciblyCaught ( void  ) inline ◆ MarkAsForciblyCaught() [2/2] void CQueueItemBase::MarkAsForciblyCaught ( void  ) inline ◆ NCBI_EXCEPTION_DEFAULT() ◆ NCBI_PARAM_DECL() NCBI_PARAM_DECL ( bool  , ThreadPool  , Catch_Unhandled_Exceptions    ) ◆ NCBI_PARAM_TYPE() typedef NCBI_PARAM_TYPE ( ThreadPool  , Catch_Unhandled_Exceptions    ) ◆ NewThread() [1/3]

template<typename TRequest >

Create a new thread.

Parameters
mode How long the thread should stay around

Implemented in CStdPoolOfThreads.

◆ NewThread() [2/3] ◆ NewThread() [3/3] TThread* CPoolOfThreads_ForServer::NewThread ( void  ) inlineprivate ◆ OnCancelRequested() void CThreadPool_Task::OnCancelRequested ( void  ) protectedvirtual ◆ OnEvent() [1/2] void CThreadPool_Controller_PID::OnEvent ( EEvent  event ) protectedvirtual

Main method for implementation of controlling algorithm.

Implements CThreadPool_Controller.

Definition at line 57 of file thread_pool_ctrl.cpp.

References CStopWatch::Elapsed(), CThreadPool_Controller::EnsureLimits(), CThreadPool_Controller::eResume, CThreadPool_Controller::eSuspend, CThreadPool::GetExecutingTasksCount(), CThreadPool_Controller::GetMaxThreads(), CThreadPool_Controller::GetMinThreads(), CThreadPool_Controller::GetPool(), CThreadPool::GetQueuedTasksCount(), CThreadPool::GetThreadsCount(), CThreadPool_Controller_PID::m_DerivCoeff, CThreadPool_Controller_PID::m_DerivTime, CThreadPool_Controller_PID::m_ErrHistory, CThreadPool_Controller_PID::m_IntegrCoeff, CThreadPool_Controller_PID::m_IntegrErr, CThreadPool_Controller_PID::m_Threshold, CThreadPool_Controller_PID::m_Timer, and CThreadPool_Controller::SetThreadsCount().

◆ OnEvent() [2/2] virtual void CThreadPool_Controller::OnEvent ( EEvent  event ) protectedpure virtual ◆ OnExit() [1/2] void CThreadPool_Thread::OnExit ( void  ) privatevirtual ◆ OnExit() [2/2]

template<typename TRequest >

◆ OnStatusChange() [1/2] void CThreadPool_Task::OnStatusChange ( EStatus  old ) protectedvirtual ◆ OnStatusChange() [2/2] ◆ operator()() ◆ operator=() [1/6]

template<typename TRequest >

◆ operator=() [2/6] ◆ operator=() [3/6] ◆ operator=() [4/6] ◆ operator=() [5/6] ◆ operator=() [6/6] ◆ operator>() ◆ Process() virtual void CStdRequest::Process ( void  ) pure virtual ◆ ProcessRequest() [1/6] ◆ ProcessRequest() [2/6] void CThreadInPool_ForServer::ProcessRequest ( const TRequestreq ) inlineprotected ◆ ProcessRequest() [3/6]

template<typename TRequest >

Older interface (still delegated to by default)

Implemented in CStdThreadInPool.

◆ ProcessRequest() [4/6] void CThreadInPool_ForServer::ProcessRequest ( TItemHandle  handle ) protected ◆ ProcessRequest() [5/6]

template<typename TRequest >

◆ ProcessRequest() [6/6] virtual void CStdThreadInPool::ProcessRequest ( TItemHandle  handle ) inlineprotectedvirtual ◆ Put() [1/2] ◆ Put() [2/2]

template<typename TRequest >

◆ Register() [1/3] bool CPoolOfThreads_ForServer::Register ( TThreadthread ) private ◆ Register() [2/3]

template<typename TRequest >

◆ Register() [3/3] void CStdPoolOfThreads::Register ( TThreadthread ) virtual ◆ RequestExclusiveExecution()

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.

The environment in which exclusive task executes can be modified by flags parameter. This method does not wait for exclusive execution, it is just adds the task to exclusive queue and starts the process of exclusive environment preparation. If next exclusive task will be added before preveous finishes (or even starts) its execution then they will be executed consequently each in its own exclusive environment (if flags parameter for them is different).

Parameters
task Task to execute exclusively flags Parameters of the exclusive environment

Definition at line 2249 of file thread_pool.cpp.

References flags, CThreadPool::m_Impl, and CThreadPool_Impl::RequestExclusiveExecution().

◆ RequestToCancel() void CThreadPool_Task::RequestToCancel ( void  ) ◆ SetChangeCalcTime() void CThreadPool_Controller_PID::SetChangeCalcTime ( double  calc_time ) inline

Set the time period (in seconds) for which average speed of changing of waiting tasks number is calculated.

Average speed is calculated by simple division of changing in waiting tasks number during this time period per time period value (all counts of tasks are calculated per each thread). By default parameter is set to 0.3.

Definition at line 211 of file thread_pool_ctrl.hpp.

References CThreadPool_Controller_PID::m_DerivTime.

◆ SetChangePredictTime() void CThreadPool_Controller_PID::SetChangePredictTime ( double  predict_time ) inline

Set period of prediction of number of tasks in queue The meaning of parameter is only approximate.

In fact it is the coefficient in derivative part of the algorithm. Meaning of the coefficient is like this: take average speed of changing of tasks count, multiply it by this prediction time, if the resulting value is greater than threshold then new thread is needed. By default parameter is set to 0.5.

See also
SetQueuedTasksThreshold()

Definition at line 223 of file thread_pool_ctrl.hpp.

References CThreadPool_Controller_PID::m_DerivCoeff.

◆ SetDestroyTimeout() ◆ SetMaxThreads() void CThreadPool_Controller::SetMaxThreads ( unsigned int  max_threads ) ◆ SetMinThreads() void CThreadPool_Controller::SetMinThreads ( unsigned int  min_threads ) ◆ SetQueuedTasksThreshold() void CThreadPool_Controller_PID::SetQueuedTasksThreshold ( double  threshold ) inline

Set maximum number of tasks in queue per each thread The meaning of parameter is only approximate.

In fact it is the coefficient in proportional part of the algorithm and adjustment for all other coefficients. By default parameter is set to 3.

Definition at line 187 of file thread_pool_ctrl.hpp.

References CThreadPool_Controller_PID::m_Threshold.

◆ SetRequest() ◆ SetTaskMaxQueuedTime() void CThreadPool_Controller_PID::SetTaskMaxQueuedTime ( double  queued_time ) inline

Set maximum time (in seconds) that task can wait in queue for processing until new thread will be launched.

The meaning of parameter is only approximate. In fact it is the coefficient in integral part of the algorithm and effectively if only one task will be considered then coefficient will be multiplied by number of currently running threads and currently set threshold. By default parameter is set to 0.2.

See also
SetQueuedTasksThreshold()

Definition at line 199 of file thread_pool_ctrl.hpp.

References CThreadPool_Controller_PID::m_IntegrCoeff.

◆ SetThreadsCount() void CThreadPool_Controller::SetThreadsCount ( unsigned int  count ) protected ◆ SetUserPriority() [1/2]

template<typename TRequest >

◆ SetUserPriority() [2/2]

template<typename TRequest >

◆ Spawn() [1/2] void CPoolOfThreads_ForServer::Spawn ( unsigned int  num_threads ) ◆ Spawn() [2/2]

template<typename TRequest >

◆ SThreadPool_PID_ErrInfo() SThreadPool_PID_ErrInfo::SThreadPool_PID_ErrInfo ( double  time_, double  err_  ) inline

Definition at line 64 of file thread_pool_ctrl.hpp.

◆ UnRegister() [1/3] void CPoolOfThreads_ForServer::UnRegister ( TThreadthread ) private ◆ UnRegister() [2/3]

template<typename TRequest >

◆ UnRegister() [3/3] void CStdPoolOfThreads::UnRegister ( TThreadthread ) virtual ◆ WaitForHunger()

template<typename TRequest >

◆ WaitForRoom() [1/2]

template<typename TRequest >

◆ WaitForRoom() [2/2]

template<typename TRequest >

◆ Withdraw() [1/2]

template<typename TRequest >

◆ Withdraw() [2/2]

template<typename TRequest >

◆ x_AcceptRequest()

template<typename TRequest >

◆ x_AttachToPool() ◆ x_DetachFromPool() void CThreadPool_Controller::x_DetachFromPool ( void  ) inlineprivate ◆ x_GetSemPred()

template<typename TRequest >

◆ x_HandleOneRequest() [1/2] void CThreadInPool_ForServer::x_HandleOneRequest ( bool  catch_all ) private ◆ x_HandleOneRequest() [2/2]

template<typename TRequest >

◆ x_HungerSemPred()

template<typename TRequest >

◆ x_Init() void CThreadPool_Task::x_Init ( unsigned int  priority ) private ◆ x_OnExit()

template<typename TRequest >

◆ x_PutSemPred()

template<typename TRequest >

◆ x_RequestToCancel() void CThreadPool_Task::x_RequestToCancel ( void  ) inlineprivate ◆ x_ResetOwner() void CThreadPool_Task::x_ResetOwner ( void  ) inlineprivate ◆ x_RunNewThread()

template<typename TRequest >

◆ x_SetOwner() ◆ x_SetStatus() [1/5] virtual void CQueueItemBase_ForServer::x_SetStatus ( EStatus  new_status ) inlineprotectedvirtual ◆ x_SetStatus() [2/5] void CBlockingQueue_ForServer::CQueueItem::x_SetStatus ( EStatus  new_status ) inlineprotected ◆ x_SetStatus() [3/5] void CThreadPool_Task::x_SetStatus ( EStatus  new_status ) private ◆ x_SetStatus() [4/5] virtual void CQueueItemBase::x_SetStatus ( EStatus  new_status ) inlineprotectedvirtual ◆ x_SetStatus() [5/5] ◆ x_UnregisterThread() [1/2] void CThreadInPool_ForServer::x_UnregisterThread ( void  ) private ◆ x_UnregisterThread() [2/2]

template<typename TRequest >

◆ x_WaitForPredicate()

template<typename TRequest >

Definition at line 884 of file thread_pool_old.hpp.

References CurrentTime(), CTime::eCurrent, CTime::eGmt, ePositive, CTimeSpan::GetCompleteSeconds(), CTimeSpan::GetNanoSecondsAfterSecond(), CTimeSpan::GetSign(), CGuard< Resource, Lock, Unlock, ReportExceptions >::Guard(), kMax_Int, kNanoSecondsPerSecond, CGuard< Resource, Lock, Unlock, ReportExceptions >::Release(), and CSemaphore::TryWait().

◆ ~CAutoUnregGuard() [1/2] CThreadInPool_ForServer::CAutoUnregGuard::~CAutoUnregGuard ( void  )

Definition at line 159 of file server.cpp.

◆ ~CAutoUnregGuard() [2/2] ◆ ~CCompletingHandle() [1/2] CBlockingQueue_ForServer::CCompletingHandle::~CCompletingHandle ( ) inline ◆ ~CCompletingHandle() [2/2] ◆ ~CPoolOfThreads()

template<typename TRequest >

◆ ~CPoolOfThreads_ForServer() CPoolOfThreads_ForServer::~CPoolOfThreads_ForServer ( void  ) virtual ◆ ~CStdPoolOfThreads() CStdPoolOfThreads::~CStdPoolOfThreads ( ) virtual ◆ ~CStdRequest() virtual CStdRequest::~CStdRequest ( void  ) inlinevirtual ◆ ~CThreadInPool()

template<typename TRequest >

◆ ~CThreadInPool_ForServer() CThreadInPool_ForServer::~CThreadInPool_ForServer ( void  ) protectedvirtual ◆ ~CThreadPool() CThreadPool::~CThreadPool ( void  ) virtual

Destructor – will wait for all its threads to finish with the timeout set by CThreadPool::SetDestroyTimeout(); current default is 10 seconds.

If this timeout is not enough for threads to terminate CThreadPool will be destroyed but all threads will finish later without any "segmentation fault" errors because CThreadPool_Impl object will remain in memory until all its threads finish.

Note
If this CThreadPool object is destroyed at the end of the application and it will fail to finish all threads in destructor, then all memory allocated by CThreadPool_Impl can be shown as leakage in the memory checking tools (like Valgrind). To avoid these leakages or for some other reasons to make sure that ThreadPool finishes all its operations before the destructor you can call method Abort() at any place in your application.
See also
Abort(), SetDestroyTimeout()

Definition at line 2195 of file thread_pool.cpp.

References CThreadPool_Impl::DestroyReference(), and CThreadPool::m_Impl.

◆ ~CThreadPool_Controller() CThreadPool_Controller::~CThreadPool_Controller ( void  ) protectedvirtual ◆ ~CThreadPool_Task() CThreadPool_Task::~CThreadPool_Task ( void  ) protectedvirtual ◆ ~CThreadPool_Thread() CThreadPool_Thread::~CThreadPool_Thread ( void  ) protectedvirtual ◆ call_time double SThreadPool_PID_ErrInfo::call_time ◆ err double SThreadPool_PID_ErrInfo::err ◆ m_CancelRequested atomic<bool> CThreadPool_Task::m_CancelRequested private ◆ m_Counted bool CThreadInPool_ForServer::m_Counted private ◆ m_Counter

template<typename TRequest >

◆ m_Delta

template<typename TRequest >

◆ m_DerivCoeff double CThreadPool_Controller_PID::m_DerivCoeff private ◆ m_DerivTime double CThreadPool_Controller_PID::m_DerivTime private ◆ m_ErrHistory ◆ m_GetCond ◆ m_GetSem

template<typename TRequest >

◆ m_HungerCnt

template<typename TRequest >

◆ m_HungerSem

template<typename TRequest >

◆ m_Impl [1/2]

Actual implementation of the pool.

Definition at line 420 of file thread_pool.hpp.

Referenced by CThreadPool::Abort(), CThreadPool::AddTask(), CThreadPool::CancelTask(), CThreadPool::CancelTasks(), CThreadPool::CThreadPool(), CThreadPool::FlushThreads(), CThreadPool::GetDestroyTimeout(), CThreadPool::GetExecutingTasksCount(), CThreadPool::GetMainPoolMutex(), CThreadPool::GetQueuedTasksCount(), CThreadPool::GetThreadsCount(), CThreadPool::IsAborted(), CThreadPool::RequestExclusiveExecution(), CThreadPool_Impl::s_GetImplPointer(), CThreadPool::SetDestroyTimeout(), and CThreadPool::~CThreadPool().

◆ m_Impl [2/2] ◆ m_InHandleEvent bool CThreadPool_Controller::m_InHandleEvent private ◆ m_IntegrCoeff double CThreadPool_Controller_PID::m_IntegrCoeff private ◆ m_IntegrErr double CThreadPool_Controller_PID::m_IntegrErr private ◆ m_IsBusy ◆ m_KilledAll bool CPoolOfThreads_ForServer::m_KilledAll private ◆ m_MaxSize

template<typename TRequest >

◆ m_MaxThreads [1/3] volatile TACValue CPoolOfThreads_ForServer::m_MaxThreads private ◆ m_MaxThreads [2/3] unsigned int CThreadPool_Controller::m_MaxThreads private ◆ m_MaxThreads [3/3]

template<typename TRequest >

◆ m_MaxUrgentThreads

template<typename TRequest >

The maximum number of urgent threads running simultaneously.

Definition at line 504 of file thread_pool_old.hpp.

◆ m_MinThreads unsigned int CThreadPool_Controller::m_MinThreads private ◆ m_Mutex [1/4] CMutex CBlockingQueue_ForServer::m_Mutex mutableprotected ◆ m_Mutex [2/4] CMutex CPoolOfThreads_ForServer::m_Mutex private ◆ m_Mutex [3/4]

template<typename TRequest >

◆ m_Mutex [4/4]

template<typename TRequest >

◆ m_Pool [1/4] TPool* CThreadInPool_ForServer::m_Pool private ◆ m_Pool [2/4] ◆ m_Pool [3/4] ◆ m_Pool [4/4]

template<typename TRequest >

◆ m_Priority [1/2] unsigned int CThreadPool_Task::m_Priority private ◆ m_Priority [2/2] ◆ m_PutSem

template<typename TRequest >

◆ m_Queue [1/4] ◆ m_Queue [2/4] TQueue CPoolOfThreads_ForServer::m_Queue private ◆ m_Queue [3/4]

template<typename TRequest >

◆ m_Queue [4/4]

template<typename TRequest >

◆ m_QueuingForbidden ◆ m_Request [1/2] TRequest CBlockingQueue_ForServer::CQueueItem::m_Request private ◆ m_Request [2/2]

template<typename TRequest >

◆ m_RequestCounter ◆ m_RunMode

template<typename TRequest >

◆ m_Status [1/3] EStatus CQueueItemBase_ForServer::m_Status protected ◆ m_Status [2/3] atomic<EStatus> CThreadPool_Task::m_Status private ◆ m_Status [3/3] ◆ m_Thread [1/2] ◆ m_Thread [2/2] ◆ m_ThreadCount [1/2] ◆ m_ThreadCount [2/2]

template<typename TRequest >

◆ m_ThreadName

template<typename TRequest >

◆ m_Threads [1/2] TThreads CPoolOfThreads_ForServer::m_Threads private ◆ m_Threads [2/2] ◆ m_Threshold [1/2] double CThreadPool_Controller_PID::m_Threshold private ◆ m_Threshold [2/2]

template<typename TRequest >

◆ m_ThrSuffix string CPoolOfThreads_ForServer::m_ThrSuffix private ◆ m_Timer ◆ m_UrgentThreadCount

template<typename TRequest >

◆ CAutoUnregGuard [1/2] ◆ CAutoUnregGuard [2/2] ◆ CBlockingQueue< TRequest > ◆ CBlockingQueue_ForServer ◆ CThreadInPool< TRequest > ◆ CThreadInPool_ForServer ◆ CThreadPool_Impl [1/3] ◆ CThreadPool_Impl [2/3] ◆ CThreadPool_Impl [3/3] ◆ CThreadPool_ThreadImpl

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