ldas-tools-al  2.6.5
Classes | Static Public Member Functions | List of all members
LDASTools::AL::ThreadPool Class Reference

Maintains a pool of threads. More...

#include <ThreadPool.hh>

Classes

class  UnaryFunction
 Base for unary functions to be used in ForEach call. More...
 

Static Public Member Functions

static TaskThread * Acquire ()
 Acquire a thread. More...
 
static bool Active (TaskThread *Resource)
 Check if a Thread is currently active. More...
 
static void ForEach (UnaryFunction &Func)
 Iterate over the active threads. More...
 
static void Relinquish (TaskThread *Resource)
 Return a thread to the pool. More...
 
static void Reset ()
 Release all resources from the thread pool. More...
 
static TaskThread * Acquire ()
 Acquire a thread. More...
 
static bool Active (TaskThread *Resource)
 Check if a Thread is currently active. More...
 
static void ForEach (UnaryFunction &Func)
 Iterate over the active threads. More...
 
static void Relinquish (TaskThread *Resource)
 Return a thread to the pool. More...
 
static void Reset ()
 Release all resources from the thread pool.
 
static TaskThread * Acquire ()
 Acquire a thread. More...
 
static bool Active (TaskThread *Resource)
 Check if a Thread is currently active. More...
 
static void ForEach (UnaryFunction &Func)
 Iterate over the active threads. More...
 
static void Relinquish (TaskThread *Resource)
 Return a thread to the pool. More...
 
static void Reset ()
 Release all resources from the thread pool.
 

Detailed Description

Maintains a pool of threads.

This is a singleton class that maintains a list of threads that can be reused to perform asyncronous tasks.

Member Function Documentation

◆ Acquire() [1/3]

TaskThread * LDASTools::AL::ThreadPool::Acquire ( )
static

Acquire a thread.

Returns
A resouce from the pool.

Secure a resource from the pool of resouces. If there is no resouce available at the time of the call, a new resouce is allocated and returned to the caller.

◆ Acquire() [2/3]

static TaskThread* LDASTools::AL::ThreadPool::Acquire ( )
static

Acquire a thread.

Returns
A resouce from the pool.

◆ Acquire() [3/3]

static TaskThread* LDASTools::AL::ThreadPool::Acquire ( )
static

Acquire a thread.

Returns
A resouce from the pool.

◆ Active() [1/3]

bool LDASTools::AL::ThreadPool::Active ( TaskThread *  Resource)
static

Check if a Thread is currently active.

Check for Resource.

Parameters
[in]ResourceCheck a resouce if in the pool.

◆ Active() [2/3]

static bool LDASTools::AL::ThreadPool::Active ( TaskThread *  Resource)
static

Check if a Thread is currently active.

Parameters
[in]ResourceCheck a resouce if in the pool.

◆ Active() [3/3]

static bool LDASTools::AL::ThreadPool::Active ( TaskThread *  Resource)
static

Check if a Thread is currently active.

Parameters
[in]ResourceCheck a resouce if in the pool.

◆ ForEach() [1/3]

static void LDASTools::AL::ThreadPool::ForEach ( UnaryFunction Func)
static

Iterate over the active threads.

Parameters
[in]FuncFunction to execute.

◆ ForEach() [2/3]

static void LDASTools::AL::ThreadPool::ForEach ( UnaryFunction Func)
static

Iterate over the active threads.

Parameters
[in]FuncFunction to execute.

◆ ForEach() [3/3]

void LDASTools::AL::ThreadPool::ForEach ( UnaryFunction Func)
static

Iterate over the active threads.

Loop over each active thread in a thread safe manor.

Parameters
[in]FuncFunction to execute.

◆ Relinquish() [1/3]

static void LDASTools::AL::ThreadPool::Relinquish ( TaskThread *  Resource)
static

Return a thread to the pool.

Parameters
[in]ResourceReturn a resouce to the pool.

◆ Relinquish() [2/3]

void LDASTools::AL::ThreadPool::Relinquish ( TaskThread *  Resource)
static

Return a thread to the pool.

Recyle the resource.

Parameters
[in]ResourceReturn a resouce to the pool.

◆ Relinquish() [3/3]

static void LDASTools::AL::ThreadPool::Relinquish ( TaskThread *  Resource)
static

Return a thread to the pool.

Parameters
[in]ResourceReturn a resouce to the pool.

◆ Reset()

void LDASTools::AL::ThreadPool::Reset ( )
static

Release all resources from the thread pool.

Note
This method should not be called by others. It is provided to help facilitate cleanup at program exit.

Get rid of threads currently doing something interesting

Get rid of threads waiting to do something interesting


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