PFUNC 1.0
|
#include <pfunc/prio.hpp>
Public Types | |
typedef task_traits< ValueType > ::attribute | attribute |
typedef task_traits< ValueType > ::functor | functor |
typedef compare_task_ptr < attribute, functor > | compare_type |
typedef std::priority_queue < ValueType *, std::vector < ValueType * >, compare_type > | queue_type |
typedef queue_type::value_type | value_type |
typedef unsigned int | queue_index_type |
typedef task_queue_set_data < queue_type > | data_type |
Public Member Functions | |
task_queue_set (unsigned int num_queues) PFUNC_CONSTRUCTOR_TRY_BLOCK() | |
~task_queue_set () | |
template<typename TaskPredicatePair > | |
bool | test_and_get (queue_index_type queue_num, const TaskPredicatePair &cnd, value_type &value, bool own_queue) |
template<typename TaskPredicatePair > | |
value_type | get (queue_index_type queue_num, const TaskPredicatePair &cnd) |
void | put (queue_index_type queue_num, const value_type &value) |
Public Attributes | |
ALIGN128 data_type * | data |
ALIGN128 unsigned int | num_queues |
Specialization of task_queue_set for priority queues.
typedef task_traits<ValueType>::attribute pfunc::detail::task_queue_set< prioS, ValueType >::attribute |
Type of the task attribute
typedef compare_task_ptr<attribute, functor> pfunc::detail::task_queue_set< prioS, ValueType >::compare_type |
Type of the priority comparison operator
typedef task_queue_set_data<queue_type> pfunc::detail::task_queue_set< prioS, ValueType >::data_type |
task_queue_set data
typedef task_traits<ValueType>::functor pfunc::detail::task_queue_set< prioS, ValueType >::functor |
Type of the task functor
typedef unsigned int pfunc::detail::task_queue_set< prioS, ValueType >::queue_index_type |
type to index into the queue
typedef std::priority_queue<ValueType*, std::vector<ValueType*>, compare_type> pfunc::detail::task_queue_set< prioS, ValueType >::queue_type |
Type of the priority_queue
typedef queue_type::value_type pfunc::detail::task_queue_set< prioS, ValueType >::value_type |
Type of the items stored in the priority_queue
pfunc::detail::task_queue_set< prioS, ValueType >::task_queue_set | ( | unsigned int | num_queues | ) | [inline] |
Constructor
[in] | num_queues | Number of task queues to create. |
pfunc::detail::task_queue_set< prioS, ValueType >::~task_queue_set | ( | ) | [inline] |
Destructor
value_type pfunc::detail::task_queue_set< prioS, ValueType >::get | ( | queue_index_type | queue_num, |
const TaskPredicatePair & | cnd | ||
) | [inline] |
Get a suitable task from the queue. First, we check if a task can be retrieved from the task queue passed to us. If not, we check every other task queue for a task (this constitues a steal). Note that the predicate for the steal is different from the one for regular task retrieval.
[in] | queue_num | The first queue to check on. |
[in] | cnd | The predicate to be satisfied. |
void pfunc::detail::task_queue_set< prioS, ValueType >::put | ( | queue_index_type | queue_num, |
const value_type & | value | ||
) | [inline] |
Store the value at the front of the given queue
[in] | queue_num | The task queue to use. |
[in] | value | The value (task ptr) to be stored. |
bool pfunc::detail::task_queue_set< prioS, ValueType >::test_and_get | ( | queue_index_type | queue_num, |
const TaskPredicatePair & | cnd, | ||
value_type & | value, | ||
bool | own_queue | ||
) | [inline] |
Check if there is something at the front of the given task queue that meets our predicate. If so, get it. Remember that the predicate is always true for LIFO. Its there simply so that we have the same interface with other scheduling policies that require a predicate.
[in] | queue_num | The task queue to check for tasks. |
[in] | cnd | The predicate to be satisfied. |
[out] | value | If a suitable task is found, its put here. |
[in] | own_queue | Is true if removing element from own_queue. |
ALIGN128 data_type* pfunc::detail::task_queue_set< prioS, ValueType >::data |
Holds all the data required
ALIGN128 unsigned int pfunc::detail::task_queue_set< prioS, ValueType >::num_queues |
Number of queues