35 #ifndef THE_THREAD_POOL_HXX_
36 #define THE_THREAD_POOL_HXX_
43 #include <Core/ITKCommon/ThreadUtils/the_thread_interface.hxx>
44 #include <Core/ITKCommon/ThreadUtils/the_transaction.hxx>
61 static void notify_cb(
void * data,
63 the_transaction_t::state_t s);
66 the_transaction_t::state_t s);
74 the_transaction_t::notify_cb_t cb_;
77 const unsigned int num_parts_;
78 unsigned int notified_[the_transaction_t::DONE_E + 1];
94 { thread_->delete_this(); }
118 void set_idle_sleep_duration(
bool enable,
unsigned int microseconds = 10000);
126 bool multithreaded =
false);
129 bool multithreaded =
false);
131 virtual void push_back(std::list<the_transaction_t *> & schedule,
132 bool multithreaded =
false);
135 void pre_distribute_work();
138 bool has_work()
const;
142 bool multithreaded =
false);
158 void terminate_transactions();
162 bool multithreaded =
false);
163 void stop_and_go(std::list<the_transaction_t *> & schedule,
164 bool multithreaded =
false);
168 bool multithreaded =
false);
169 void flush_and_go(std::list<the_transaction_t *> & schedule,
170 bool multithreaded =
false);
174 void blab(
const char * message)
const;
180 inline const unsigned int & pool_size()
const
181 {
return pool_size_; }
195 assert(
id < pool_size_);
196 return pool_[id].thread_;
199 void no_lock_flush();
200 void no_lock_terminate_transactions();
203 void no_lock_push_back(std::list<the_transaction_t *> & schedule,
bool mt);
210 unsigned int pool_size_;
213 std::list<unsigned int> busy_;
216 std::list<unsigned int> idle_;
219 std::list<the_transaction_t *> transactions_;
223 #endif // THE_THREAD_POOL_HXX_
Definition: the_thread_pool.hxx:85
Definition: the_transaction.hxx:55
Definition: the_transaction.hxx:181
Definition: the_mutex_interface.hxx:42
Definition: the_thread_pool.hxx:105
Definition: the_thread_pool.hxx:54
Definition: the_thread_interface.hxx:57