Lines Matching refs:queue
17 #include <queue>
42 /// The main interface of this pattern is a @ref queue of @ref tasks
43 /// to be performed. Associated to that queue are a set of worker
45 /// until at least one @ref task is added to the queue.
47 /// When a @ref task is added to the @ref queue, one thread is woken
48 /// up, picks the @ref task, removes it from the @ref queue, and
53 /// performed @ref task is added to another queue, named as the "done
54 /// queue". Then the thread looks at the @ref queue of tasks to be
55 /// performed again, and if there is at least one task in that queue,
57 /// waiting for a new task to be added to the queue.
62 /// Note that the user of the queue can either wait for all the tasks
68 /// performed and added to the "done queue".
80 /// This is an implementation detail of the @ref queue public
90 static queue::priv*
91 wait_to_execute_a_task(queue::priv*);
96 // <queue stuff>
98 /// The private data structure of the task queue.
99 struct queue::priv
108 // A mutex that protects the todo tasks queue from being accessed in
111 // The queue condition variable. This condition is used to make the
112 // worker threads sleep until a new task is added to the queue of
113 // todo tasks. Whenever a new task is added to that queue, a signal
116 // A mutex that protects the done tasks queue from being accessed in
122 // The todo task queue itself.
123 std::queue<task_sptr> tasks_todo;
124 // The done task queue itself.
126 // This functor is invoked to notify the user of this queue that a
129 // notifier of the work queue; the one that is used when the user
133 // the queue. It's either the one specified by the user or the
139 /// A constructor of @ref queue::priv.
159 /// waiting for a task to be added to the todo queue.
174 /// Submit a task to the queue of tasks to be performed.
181 /// scheduled. If the queue is empty, the task @p t won't be
198 /// Submit a vector of task to the queue of tasks to be performed.
242 // Now that the task queue is empty, drain the workers by waking them up,
253 /// Destructors of @ref queue::priv type.
257 }; //end struct queue::priv
260 queue::task_done_notify queue::priv::default_notify;
262 /// Default constructor of the @ref queue type.
264 /// By default the queue is created with a number of worker threaders
267 queue::queue()
271 /// Constructor of the @ref queue type.
275 queue::queue(unsigned number_of_workers)
279 /// Constructor of the @ref queue type.
291 queue::queue(unsigned number_of_workers,
296 /// Getter of the size of the queue. This gives the number of task
297 /// still present in the queue.
299 /// @return the number of task still present in the queue.
301 queue::get_size() const
304 /// Submit a task to the queue of tasks to be performed.
310 /// @param t the task to schedule. Note that if the queue is empty or
315 queue::schedule_task(const task_sptr& t)
318 /// Submit a vector of tasks to the queue of tasks to be performed.
327 queue::schedule_tasks(const tasks_type& tasks)
340 queue::wait_for_workers_to_complete()
347 queue::get_completed_tasks() const
350 /// Destructor for the @ref queue type.
351 queue::~queue()
354 /// The default function invocation operator of the @ref queue type.
358 queue::task_done_notify::operator()(const task_sptr&/*task_done*/)
362 // </queue stuff>
371 /// @param t the private data of the "task queue" type to consider.
373 /// @param return the same private data of the task queue type we got
375 queue::priv*
376 worker::wait_to_execute_a_task(queue::priv* p)
381 // If there is no more tasks to perform and the queue is not to
387 // so, get a task from the queue ...