PFUNC  1.0
Public Types | Public Member Functions | Public Attributes
pfunc::detail::task_queue_set< prioS, ValueType > Struct Template Reference

#include <pfunc/prio.hpp>

List of all members.

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_typedata
ALIGN128 unsigned int num_queues

Detailed Description

template<typename ValueType>
struct pfunc::detail::task_queue_set< prioS, ValueType >

Specialization of task_queue_set for priority queues.


Member Typedef Documentation

template<typename ValueType >
typedef task_traits<ValueType>::attribute pfunc::detail::task_queue_set< prioS, ValueType >::attribute

Type of the task attribute

template<typename ValueType >
typedef compare_task_ptr<attribute, functor> pfunc::detail::task_queue_set< prioS, ValueType >::compare_type

Type of the priority comparison operator

template<typename ValueType >
typedef task_queue_set_data<queue_type> pfunc::detail::task_queue_set< prioS, ValueType >::data_type
template<typename ValueType >
typedef task_traits<ValueType>::functor pfunc::detail::task_queue_set< prioS, ValueType >::functor

Type of the task functor

template<typename ValueType >
typedef unsigned int pfunc::detail::task_queue_set< prioS, ValueType >::queue_index_type

type to index into the queue

template<typename ValueType >
typedef std::priority_queue<ValueType*, std::vector<ValueType*>, compare_type> pfunc::detail::task_queue_set< prioS, ValueType >::queue_type

Type of the priority_queue

template<typename ValueType >
typedef queue_type::value_type pfunc::detail::task_queue_set< prioS, ValueType >::value_type

Type of the items stored in the priority_queue


Constructor & Destructor Documentation

template<typename ValueType >
pfunc::detail::task_queue_set< prioS, ValueType >::task_queue_set ( unsigned int  num_queues) [inline]

Constructor

Parameters:
[in]num_queuesNumber of task queues to create.
template<typename ValueType >
pfunc::detail::task_queue_set< prioS, ValueType >::~task_queue_set ( ) [inline]

Destructor


Member Function Documentation

template<typename ValueType >
template<typename TaskPredicatePair >
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.

Parameters:
[in]queue_numThe first queue to check on.
[in]cndThe predicate to be satisfied.
Returns:
value_type The retrieved task if found.
NULL If no suitable task is found.
template<typename ValueType >
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

Parameters:
[in]queue_numThe task queue to use.
[in]valueThe value (task ptr) to be stored.
template<typename ValueType >
template<typename TaskPredicatePair >
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.

Parameters:
[in]queue_numThe task queue to check for tasks.
[in]cndThe predicate to be satisfied.
[out]valueIf a suitable task is found, its put here.
[in]own_queueIs true if removing element from own_queue.
Returns:
true If a suitable task is found.
false If no suitable tasks could be found.

Member Data Documentation

template<typename ValueType >
ALIGN128 data_type* pfunc::detail::task_queue_set< prioS, ValueType >::data

Holds all the data required

template<typename ValueType >
ALIGN128 unsigned int pfunc::detail::task_queue_set< prioS, ValueType >::num_queues

Number of queues


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