Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Threads Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWThreadPool

Module:  Threads   Package:  Threading


RWThreadPool RWHandleBase

Local Index

Members

Header File

#include <rw/thread/RWThreadPool.h>

Description

The RWThreadPool object manages a pool of RWThread instances that are used to execute work encapsulated as RWFunctor0 functors. A thread pool object, when started, waits for other threads to enqueue work functors that they would like to have executed. Pool threads dequeue functors and execute them to completion. This process continues until the thread pool object passes out of scope, the destructor is called, or the stop() member function is called.

A thread pool can have a fixed number of threads, or its size may grow and shrink dynamically, according to load. The dynamic nature of the pool is controlled by parameters in the make() member function.

Example

Static Member Functions

static RWThreadPool
make(size_t minThreads, size_t maxThreads = RW_THR_NO_DYNAMIC_THREAD_POOL, unsigned long timeout = RW_THR_NO_TIMEOUT);
static RWThreadPool
make(size_t minThreads, const RWThreadAttribute& poolThreadsAttr, size_t maxThreads = RW_THR_NO_DYNAMIC_THREAD_POOL, unsigned long timeout = RW_THR_NO_TIMEOUT);

Public Constructors

RWThreadPool();
RWThreadPool(const RWThreadPool& second);

Public Destructor

~RWThreadPool();

Public Member Operator

RWThreadPool&
operator=(const RWThreadPool& second);

Public Member Functions

void
enqueue(const RWFunctor0& functor);
size_t
entries() const;
RWThreadAttribute
getPoolAttribute();
bool
resize(size_t minThreads,
       size_t maxThreads = RW_THR_NO_DYNAMIC_THREAD_POOL);
size_t
size() const;
void
stop();

See Also

RWThread, RWFunctor0, RWHandleBase::isValid()



Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.