| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Protected Attributes | List of all members
boost::threadpool::prio_scheduler< Task > Class Template Reference

SchedulingPolicy which implements prioritized ordering. More...

`#include <src/threadpool/boost/threadpool/scheduling_policies.hpp>`

Collaboration diagram for boost::threadpool::prio_scheduler< Task >:
[legend]

## Public Types
typedef Task | task_type
| Indicates the scheduler's task type. More...

## Public Member Functions
bool | push (task_type const &task)
| Adds a new task to the scheduler. More...
void | pop ()
| Removes the task which should be executed next. More...
task_type const & | top () const
| Gets the task which should be executed next. More...
size_t | size () const
| Gets the current number of tasks in the scheduler. More...
bool | empty () const
| Checks if the scheduler is empty. More...
void | clear ()
| Removes all tasks from the scheduler. More...

## Protected Attributes
std::priority_queue< task_type > | m_container
| Internal task container. More...

## Detailed Description

### template<typename Task = prio_task_func>
class boost::threadpool::prio_scheduler< Task >

SchedulingPolicy which implements prioritized ordering.

This container implements a scheduling policy based on task priorities. The task with highest priority will be the first to be removed. It must be possible to compare two tasks using operator<.

Parameters

  Task | A function object which implements the operator() and operator<. operator< must be a partial ordering.

See also
  prio_thread_func

Definition at line 193 of file scheduling_policies.hpp.

## Member Typedef Documentation

template<typename Task = prio_task_func>

typedef Task boost::threadpool::prio_scheduler< Task >::task_type

Indicates the scheduler's task type.

Definition at line 196 of file scheduling_policies.hpp.

## Member Function Documentation

template<typename Task = prio_task_func>

void boost::threadpool::prio_scheduler< Task >::clear | ( |  | ) |
| inline

Removes all tasks from the scheduler.

Definition at line 248 of file scheduling_policies.hpp.

249 {
250 while(!m_container.empty())
251 {
252 m_container.pop();
253 }
254 }
std::priority_queue::empty
T empty(T...args)
std::priority_queue::pop
T pop(T...args)
boost::threadpool::prio_scheduler::m_container
std::priority_queue< task_type > m_container
Internal task container.
Definition: scheduling_policies.hpp:199
template<typename Task = prio_task_func>

bool boost::threadpool::prio_scheduler< Task >::empty | ( |  | ) | const
| inline

Checks if the scheduler is empty.

Returns
  true if the scheduler contains no tasks, false otherwise.

Remarks
  Is more efficient than size() == 0.

Definition at line 241 of file scheduling_policies.hpp.

242 {
243 return m_container.empty();
244 }
std::priority_queue::empty
T empty(T...args)
boost::threadpool::prio_scheduler::m_container
std::priority_queue< task_type > m_container
Internal task container.
Definition: scheduling_policies.hpp:199
template<typename Task = prio_task_func>

void boost::threadpool::prio_scheduler< Task >::pop | ( |  | ) |
| inline

Removes the task which should be executed next.

Definition at line 215 of file scheduling_policies.hpp.

216 {
217 m_container.pop();
218 }
std::priority_queue::pop
T pop(T...args)
boost::threadpool::prio_scheduler::m_container
std::priority_queue< task_type > m_container
Internal task container.
Definition: scheduling_policies.hpp:199
template<typename Task = prio_task_func>

bool boost::threadpool::prio_scheduler< Task >::push | ( | task_type const & | task | ) |
| inline

Adds a new task to the scheduler.

Parameters

  task | The task object.

Returns
  true, if the task could be scheduled and false otherwise.

Definition at line 207 of file scheduling_policies.hpp.

208 {
209 m_container.push(task);
210 return true;
211 }
boost::threadpool::prio_scheduler::m_container
std::priority_queue< task_type > m_container
Internal task container.
Definition: scheduling_policies.hpp:199
std::priority_queue::push
T push(T...args)
template<typename Task = prio_task_func>

size_t boost::threadpool::prio_scheduler< Task >::size | ( |  | ) | const
| inline

Gets the current number of tasks in the scheduler.

Returns
  The number of tasks.

Remarks
  Prefer empty() to size() == 0 to check if the scheduler is empty.

Definition at line 232 of file scheduling_policies.hpp.

233 {
234 return m_container.size();
235 }
boost::threadpool::prio_scheduler::m_container
std::priority_queue< task_type > m_container
Internal task container.
Definition: scheduling_policies.hpp:199
std::priority_queue::size
T size(T...args)
template<typename Task = prio_task_func>

task_type const& boost::threadpool::prio_scheduler< Task >::top | ( |  | ) | const
| inline

Gets the task which should be executed next.

Returns
  The task object to be executed.

Definition at line 223 of file scheduling_policies.hpp.

224 {
225 return m_container.top();
226 }
std::priority_queue::top
T top(T...args)
boost::threadpool::prio_scheduler::m_container
std::priority_queue< task_type > m_container
Internal task container.
Definition: scheduling_policies.hpp:199

## Member Data Documentation

template<typename Task = prio_task_func>

std::priority_queue<task_type> boost::threadpool::prio_scheduler< Task >::m_container
| protected

Internal task container.

Definition at line 199 of file scheduling_policies.hpp.

The documentation for this class was generated from the following file:

- GaudiMTTools/src/threadpool/boost/threadpool/scheduling_policies.hpp