- POCO_THREAD_STACK_SIZE macro

- few Thread modifications
- ThreadPool configurable stack size
This commit is contained in:
Aleksandar Fabijanic
2008-04-20 23:28:41 +00:00
parent 537ec8aca3
commit 9fd70bade2
11 changed files with 90 additions and 40 deletions

View File

@@ -57,7 +57,8 @@ ThreadPoolTest::~ThreadPoolTest()
void ThreadPoolTest::testThreadPool()
{
ThreadPool pool(2, 3, 3);
pool.setStackSize(1);
assert (pool.allocated() == 2);
assert (pool.used() == 0);
assert (pool.capacity() == 3);

View File

@@ -263,17 +263,24 @@ void ThreadTest::testThreadFunction()
void ThreadTest::testThreadStackSize()
{
int stackSize = 50000000;
Thread thread;
assert (0 == thread.getStackSize());
thread.setStackSize(50000000);
assert (50000000 == thread.getStackSize());
thread.setStackSize(stackSize);
assert (stackSize == thread.getStackSize());
int tmp = MyRunnable::_staticVar;
thread.start(freeFunc, &tmp);
thread.join();
assert (tmp * 2 == MyRunnable::_staticVar);
thread.setStackSize(1);
assert (1 == thread.getStackSize());
stackSize = 1;
thread.setStackSize(stackSize);
#ifdef POCO_OS_FAMILY_UNIX
assert (PTHREAD_STACK_MIN == thread.getStackSize());
#else
assert (stackSize == thread.getStackSize());
#endif
tmp = MyRunnable::_staticVar;
thread.start(freeFunc, &tmp);
thread.join();