PFUNC 1.0
|
An implementation of a task structure. More...
#include <pfunc/task.hpp>
Public Types | |
typedef Attribute | attribute |
typedef Functor | functor |
Public Member Functions | |
const attribute & | get_attr () const |
group * | get_group () const |
unsigned int | get_size () const |
unsigned int | get_rank () const |
void | set_attr (const attribute &at) |
void | set_group (group *gp) |
void | set_func (functor *fn) |
void | reset_completion (const unsigned int &nwait=1) |
void | run () |
template<typename TaskManager > | |
void | wait (TaskManager &taskmgr) |
template<typename TaskManager > | |
bool | test (TaskManager &taskmgr) |
void | notify () |
template<typename TaskManager > | |
void | barrier (TaskManager &taskmgr) |
task () | |
task (const attribute &attr, const group *&grp, functor *&func) | |
~task () | |
void | shallow_copy (const task &other) |
Private Attributes | |
attribute | attr |
group * | grp |
unsigned int | gsize |
unsigned int | grank |
functor * | func |
event< testable_event > | testing_compl |
event< waitable_event > | waiting_compl |
Friends | |
bool | operator< (const task &one, const task &two) |
An implementation of a task structure.
Attribute | The type of the Attribute. |
Functor | The type of the function object to be used. |
Implements the task structure. Main intention is to enable communication of not only the task that a thread has to perform but also to provide the executing thread with attributes that are related to a particular task.
typedef Attribute pfunc::detail::task< Attribute, Functor >::attribute |
typedef Functor pfunc::detail::task< Attribute, Functor >::functor |
pfunc::detail::task< Attribute, Functor >::task | ( | ) | [inline] |
Default constructor.
pfunc::detail::task< Attribute, Functor >::task | ( | const attribute & | attr, |
const group *& | grp, | ||
functor *& | func | ||
) | [inline] |
Parameterized constructor.
[in] | attr | The attribute for this task. |
[in] | grp | The group for this task. |
[in] | func | The work function for this task. |
pfunc::detail::task< Attribute, Functor >::~task | ( | ) | [inline] |
Destructor.
void pfunc::detail::task< Attribute, Functor >::barrier | ( | TaskManager & | taskmgr | ) | [inline] |
Execute a barrier across all the tasks in this task's group.
[in] | taskmgr | The task manager that is controlling the execution. |
const attribute& pfunc::detail::task< Attribute, Functor >::get_attr | ( | ) | const [inline] |
group* pfunc::detail::task< Attribute, Functor >::get_group | ( | ) | const [inline] |
unsigned int pfunc::detail::task< Attribute, Functor >::get_rank | ( | ) | const [inline] |
unsigned int pfunc::detail::task< Attribute, Functor >::get_size | ( | ) | const [inline] |
void pfunc::detail::task< Attribute, Functor >::notify | ( | ) | [inline] |
Notify a job's completion. If there are more than one waiters on this particular task, then broadcast. Else, a simple signal will do.
void pfunc::detail::task< Attribute, Functor >::reset_completion | ( | const unsigned int & | nwait = 1 | ) | [inline] |
[in] | nwait | Number of waiters to receive notification |
void pfunc::detail::task< Attribute, Functor >::run | ( | ) | [inline] |
Run the work function
void pfunc::detail::task< Attribute, Functor >::set_attr | ( | const attribute & | at | ) | [inline] |
[in] | at | Attribute that governs execution of the task |
void pfunc::detail::task< Attribute, Functor >::set_func | ( | functor * | fn | ) | [inline] |
[in] | fn | Work function to be executed by the executing thread. |
void pfunc::detail::task< Attribute, Functor >::set_group | ( | group * | gp | ) | [inline] |
[in] | gp | The group that is associated with the task. |
void pfunc::detail::task< Attribute, Functor >::shallow_copy | ( | const task< Attribute, Functor > & | other | ) | [inline] |
bool pfunc::detail::task< Attribute, Functor >::test | ( | TaskManager & | taskmgr | ) | [inline] |
Test for the current job to complete.
[in] | taskmgr | The task manager that is controlling the execution. |
void pfunc::detail::task< Attribute, Functor >::wait | ( | TaskManager & | taskmgr | ) | [inline] |
Wait for the current job to complete.
[in] | taskmgr | The task manager that is controlling the execution. |
bool operator< | ( | const task< Attribute, Functor > & | one, |
const task< Attribute, Functor > & | two | ||
) | [friend] |
operator< to compare two tasks.
[in] | one | The first task. |
[in] | two | The second task. |
attribute pfunc::detail::task< Attribute, Functor >::attr [private] |
Attribute that describes the task
functor* pfunc::detail::task< Attribute, Functor >::func [private] |
Function object that represents the task
unsigned int pfunc::detail::task< Attribute, Functor >::grank [private] |
Rank of the task in the group
group* pfunc::detail::task< Attribute, Functor >::grp [private] |
The group for the task
unsigned int pfunc::detail::task< Attribute, Functor >::gsize [private] |
Size of the group
event<testable_event> pfunc::detail::task< Attribute, Functor >::testing_compl [private] |
testable event
event<waitable_event> pfunc::detail::task< Attribute, Functor >::waiting_compl [private] |
waitable event