Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWThreadPool


RWThreadPool RWHandleBase

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Data Types

Member Functions

Package

Threading

Header File
& Synopsis

#include <rw/thread/RWThreadPool.h>

RWThreadPool threadPool = RWThreadPool::make(10); 
//Makes a thread pool of 10 threads.

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

Public Constructors

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

Public Member Operator

RWThreadPool&
operator=(const RWThreadPool& second);

Public Member Functions

void
enqueue(const RWFunctor0& functor);
size_t
entries(void) const;
RWThreadAttribute
getPoolAttribute(void);
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);
size_t
size(void) const;
void
stop(void);

See Also

RWThread, RWFunctor0, RWHandleBase::isValid()



Previous fileTop of DocumentContentsIndexNext file

©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.