16#ifndef __ABG_WORKERS_H__
17#define __ABG_WORKERS_H__
56typedef shared_ptr<task> task_sptr;
68template<
typename Fn,
typename RetType,
typename... Args>
71 std::function<RetType(Args...)> fn_;
73 std::tuple<Args...> args_;
80 : fn_(fn), args_(args...)
93 ret_val_ = abg_compat::apply(fn_, args_);
108template<
typename Fn,
typename... Args>
111 std::function<void(Args...)> fn_;
112 std::tuple<Args...> args_;
119 : fn_(fn), args_(args...)
126 abg_compat::apply(fn_, args_);
131template<
typename Fn,
typename RetType,
typename... Args>
157 std::unique_ptr<priv> p_;
162 queue(
unsigned number_of_workers);
163 queue(
unsigned number_of_workers,
This represents a queue of tasks to be performed.
~queue()
Destructor for the queue type.
tasks_type & get_completed_tasks() const
Getter of the vector of tasks that got performed.
void wait_for_workers_to_complete()
Suspends the current thread until all worker threads finish performing the tasks they are executing.
void schedule_staged_tasks()
Schedule the tasks that have been previously staged by stage_task().
bool stage_task(const task_sptr &)
Stages a task to be scheduled later.
std::vector< task_sptr > tasks_type
A convenience typedef for a vector of task_sptr.
size_t get_size() const
Getter of the size of the queue. This gives the number of task still present in the queue.
bool schedule_tasks(const tasks_type &)
Submit a vector of tasks to the queue of tasks to be performed.
queue()
Default constructor of the queue type.
bool schedule_task(const task_sptr &)
Submit a task to the queue of tasks to be performed.
The template of a task to be performed.
This represents a task to be performed.
size_t get_number_of_threads()
size_t get_number_of_available_threads()
shared_ptr< simple_task< Fn, RetType, Args... > > simple_task_sptr
A type alias for shared_ptr<simple_task<Fn, RetType, Args...>>.
Toplevel namespace for libabigail.
This functor is to notify listeners that a given task scheduled for execution has been fully executed...
virtual void operator()(const task_sptr &task_done)
The default function invocation operator of the queue type.