16 #ifndef SURGSIM_FRAMEWORK_THREADPOOL_INL_H 17 #define SURGSIM_FRAMEWORK_THREADPOOL_INL_H 28 virtual void execute() = 0;
37 explicit Task(std::function<R()>
function) :
42 void execute()
override 47 std::future<R> getFuture()
49 return m_task.get_future();
53 std::packaged_task<R()> m_task;
59 std::unique_ptr<Task<R>> task = std::unique_ptr<Task<R>>(
new Task<R>(
function));
60 std::future<R> future = task->getFuture();
62 boost::unique_lock<boost::mutex> lock(m_mutex);
63 m_tasks.push(std::move(task));
65 m_threadSignaler.notify_one();
72 #endif //SURGSIM_FRAMEWORK_THREADPOOL_INL_H Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
Actual tasks, with typed return type.
Definition: ThreadPool-inl.h:34
Definition: ThreadPool-inl.h:25
std::future< R > enqueue(std::function< R()> function)
Queue a task to be run by the ThreadPool.
Definition: ThreadPool-inl.h:57