trunk/branch integration: VxWorks & Wince

This commit is contained in:
Marian Krivos
2011-08-22 18:02:56 +00:00
parent f66cd72471
commit 68306c2960
5 changed files with 201 additions and 110 deletions

View File

@@ -73,12 +73,19 @@ public:
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. Threads are created with given 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.
/// Creates a thread pool with the given name and 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,
@@ -135,13 +142,25 @@ public:
/// threads are available.
void stopAll();
/// Stops all running threads.
/// Stops all running threads and waits for their completion.
///
/// Will also delete all thread objects.
/// If used, this method should be the last action before
/// the thread pool is deleted.
///
/// Note: If a thread fails to stop within 10 seconds
/// (due to a programming error, for example), the
/// underlying thread object will not be deleted and
/// this method will return anyway. This allows for a
/// more or less graceful shutdown in case of a misbehaving
/// thread.
void joinAll();
/// Waits for all threads to complete.
///
/// Note that this will not actually join() the underlying
/// thread, but rather wait for the thread's runnables
/// to finish.
void collect();
/// Stops and removes no longer used threads from the
@@ -151,6 +170,11 @@ public:
/// as the thread pool is also implicitly managed in
/// calls to start(), addCapacity() and joinAll().
const std::string& name() const;
/// Returns the name of the thread pool,
/// or an empty string if no name has been
/// specified in the constructor.
static ThreadPool& defaultPool();
/// Returns a reference to the default
/// thread pool.
@@ -194,6 +218,12 @@ inline int ThreadPool::getStackSize() const
}
inline const std::string& ThreadPool::name() const
{
return _name;
}
} // namespace Poco