6 #ifndef TURI_THREAD_POOL_HPP 7 #define TURI_THREAD_POOL_HPP 9 #include <boost/bind.hpp> 10 #include <core/parallel/pthread_tools.hpp> 11 #include <core/util/blocking_queue.hpp> 54 void launch(
const boost::function<
void (
void)> &spawn_function,
55 size_t virtual_threadid =
size_t(-1));
77 std::queue<std::exception_ptr> exception_queue;
78 size_t tasks_inserted = 0;
79 size_t tasks_completed = 0;
80 bool waiting_on_join =
false;
109 size_t tasks_inserted = 0;
110 size_t tasks_completed = 0;
111 bool waiting_on_join =
false;
121 void wait_for_task();
127 void spawn_thread_group();
133 void destroy_all_threads();
140 thread_pool(
size_t nthreads = 2,
bool affinity =
false);
145 void resize(
size_t nthreads);
159 void launch(
const boost::function<
void (
void)> &spawn_function,
160 size_t virtual_threadid =
size_t(-1));
171 void set_cpu_affinity(
bool affinity);
187 static void release_instance();
void launch(const boost::function< void(void)> &spawn_function, size_t virtual_threadid=size_t(-1))
Implements a blocking queue useful for producer/consumer models.
parallel_task_queue(thread_pool &pool)