mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 18:45:10 +01:00
added stack size argument to ThreadPool constructor
This commit is contained in:
parent
9fd70bade2
commit
621c98d358
@ -69,14 +69,21 @@ class Foundation_API ThreadPool
|
||||
/// from the pool.
|
||||
{
|
||||
public:
|
||||
ThreadPool(int minCapacity = 2, int maxCapacity = 16, int idleTime = 60);
|
||||
ThreadPool(const std::string& name, int minCapacity = 2, int maxCapacity = 16, int idleTime = 60);
|
||||
ThreadPool(int minCapacity = 2,
|
||||
int maxCapacity = 16,
|
||||
int idleTime = 60,
|
||||
int stackSize = POCO_THREAD_STACK_SIZE);
|
||||
ThreadPool(const std::string& name,
|
||||
int minCapacity = 2,
|
||||
int maxCapacity = 16,
|
||||
int idleTime = 60,
|
||||
int stackSize = POCO_THREAD_STACK_SIZE);
|
||||
/// Creates a thread pool with minCapacity threads.
|
||||
/// If required, up to maxCapacity threads are created
|
||||
/// a NoThreadAvailableException exception is thrown.
|
||||
/// If a thread is running idle for more than idleTime seconds,
|
||||
/// and more than minCapacity threads are running, the thread
|
||||
/// is killed.
|
||||
/// is killed. Threads are created with given stack size.
|
||||
|
||||
~ThreadPool();
|
||||
/// Currently running threads will remain active
|
||||
|
@ -233,12 +233,16 @@ void PooledThread::run()
|
||||
}
|
||||
|
||||
|
||||
ThreadPool::ThreadPool(int minCapacity, int maxCapacity, int idleTime):
|
||||
ThreadPool::ThreadPool(int minCapacity,
|
||||
int maxCapacity,
|
||||
int idleTime,
|
||||
int stackSize):
|
||||
_minCapacity(minCapacity),
|
||||
_maxCapacity(maxCapacity),
|
||||
_idleTime(idleTime),
|
||||
_serial(0),
|
||||
_age(0)
|
||||
_age(0),
|
||||
_stackSize(stackSize)
|
||||
{
|
||||
poco_assert (minCapacity >= 1 && maxCapacity >= minCapacity && idleTime > 0);
|
||||
|
||||
@ -251,14 +255,18 @@ ThreadPool::ThreadPool(int minCapacity, int maxCapacity, int idleTime):
|
||||
}
|
||||
|
||||
|
||||
ThreadPool::ThreadPool(const std::string& name, int minCapacity, int maxCapacity, int idleTime):
|
||||
ThreadPool::ThreadPool(const std::string& name,
|
||||
int minCapacity,
|
||||
int maxCapacity,
|
||||
int idleTime,
|
||||
int stackSize):
|
||||
_name(name),
|
||||
_minCapacity(minCapacity),
|
||||
_maxCapacity(maxCapacity),
|
||||
_idleTime(idleTime),
|
||||
_serial(0),
|
||||
_age(0),
|
||||
_stackSize(0)
|
||||
_stackSize(stackSize)
|
||||
{
|
||||
poco_assert (minCapacity >= 1 && maxCapacity >= minCapacity && idleTime > 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user