MADNESS
version 0.9
|
A singleton pool of threads for dynamic execution of tasks. More...
#include <worldthread.h>
Public Member Functions | |
template<typename opT > | |
void | scan (opT &op) |
~ThreadPool () | |
Static Public Member Functions | |
static void | begin (int nthread=-1) |
Please invoke while in single threaded environment. More... | |
static void | end () |
static void | add (PoolTaskInterface *task) |
Add a new task to the pool. More... | |
static void | add (const std::vector< PoolTaskInterface * > &tasks) |
Add a vector of tasks to the pool. More... | |
static bool | run_task () |
An otherwise idle thread can all this to run a task. More... | |
static std::size_t | size () |
Returns number of threads in the pool. More... | |
static std::size_t | queue_size () |
Returns number of tasks in the queue. More... | |
static const DQStats & | get_stats () |
Returns queue statistics. More... | |
template<typename Probe > | |
static void | await (const Probe &probe, bool dowork=true) |
Gracefully wait for a condition to become true ... executes tasks if any in queue. More... | |
Friends | |
class | WorldTaskQueue |
A singleton pool of threads for dynamic execution of tasks.
YOU MUST INSTANTIATE THE POOL WHILE RUNNING WITH JUST ONE THREAD
|
inline |
|
inlinestatic |
Add a new task to the pool.
References madness::TaskAttributes::get_nthread(), madness::TaskAttributes::is_high_priority(), and MADNESS_EXCEPTION.
Referenced by madness::WorldTaskQueue::add(), add(), and end().
|
inlinestatic |
Add a vector of tasks to the pool.
References add(), and MADNESS_EXCEPTION.
|
inlinestatic |
Gracefully wait for a condition to become true ... executes tasks if any in queue.
Probe should be an object that when called returns the status.
References madness::MutexWaiter::reset(), run_task(), and madness::MutexWaiter::wait().
Referenced by madness::World::await(), and madness::WorldTaskQueue::fence().
|
static |
Please invoke while in single threaded environment.
References SafeMPI::COMM_WORLD, SafeMPI::Intracomm::Get_rank(), size(), and mpfr::trunc().
Referenced by madness::initialize(), and main().
|
static |
References add().
Referenced by madness::finalize().
|
static |
Returns queue statistics.
Referenced by madness::print_stats().
|
inlinestatic |
Returns number of tasks in the queue.
|
inlinestatic |
An otherwise idle thread can all this to run a task.
Returns true if one was run
References madness::ThreadBase::this_thread().
Referenced by await().
|
inline |
References madness::DQueue< T >::scan().
|
inlinestatic |
Returns number of threads in the pool.
Referenced by begin(), madness::initialize(), and madness::print_stats().
|
friend |