Embedded Multicore Building Blocks V1.0.0
Public Member Functions | List of all members
embb::mtapi::Group Class Reference

Represents a facility to wait for multiple related Tasks. More...

#include <group.h>

Public Member Functions

 Group ()
 Constructs an invalid Group. More...
 
 Group (Group const &other)
 Copies a Group. More...
 
Groupoperator= (Group const &other)
 Copies a Group. More...
 
void Delete ()
 Deletes a Group object. More...
 
template<typename ARGS , typename RES >
Task Start (mtapi_task_id_t task_id, Job const &job, const ARGS *arguments, RES *results, TaskAttributes const &attributes)
 Starts a new Task in this Group. More...
 
template<typename ARGS , typename RES >
Task Start (mtapi_task_id_t task_id, Job const &job, const ARGS *arguments, RES *results)
 Starts a new Task in this Group. More...
 
template<typename ARGS , typename RES >
Task Start (Job const &job, const ARGS *arguments, RES *results, TaskAttributes const &attributes)
 Starts a new Task in this Group. More...
 
template<typename ARGS , typename RES >
Task Start (Job const &job, const ARGS *arguments, RES *results)
 Starts a new Task in this Group. More...
 
mtapi_status_t WaitAny (mtapi_timeout_t timeout, void **result)
 Waits for any Task in the Group to finish for timeout milliseconds and retrieves the result buffer given in Start(). More...
 
mtapi_status_t WaitAny (void **result)
 Waits for any Task in the Group to finish and retrieves the result buffer given in Start(). More...
 
mtapi_status_t WaitAny (mtapi_timeout_t timeout)
 Waits for any Task in the Group to finish for timeout milliseconds. More...
 
mtapi_status_t WaitAny ()
 Waits for any Task in the Group to finish. More...
 
mtapi_status_t WaitAll (mtapi_timeout_t timeout)
 Waits for all Task in the Group to finish for timeout milliseconds. More...
 
mtapi_status_t WaitAll ()
 Waits for all Task in the Group to finish. More...
 
mtapi_group_hndl_t GetInternal () const
 Returns the internal representation of this object. More...
 

Detailed Description

Represents a facility to wait for multiple related Tasks.

Constructor & Destructor Documentation

embb::mtapi::Group::Group ( )

Constructs an invalid Group.

Concurrency
Thread-safe and wait-free
embb::mtapi::Group::Group ( Group const &  other)

Copies a Group.

Concurrency
Thread-safe and wait-free
Parameters
otherGroup to copy

Member Function Documentation

Group& embb::mtapi::Group::operator= ( Group const &  other)

Copies a Group.

Returns
Reference to this object.
Concurrency
Thread-safe and wait-free
Parameters
otherGroup to copy
void embb::mtapi::Group::Delete ( )

Deletes a Group object.

Concurrency
Thread-safe
template<typename ARGS , typename RES >
Task embb::mtapi::Group::Start ( mtapi_task_id_t  task_id,
Job const &  job,
const ARGS *  arguments,
RES *  results,
TaskAttributes const &  attributes 
)

Starts a new Task in this Group.

Returns
The handle to the started Task.
Concurrency
Thread-safe
Parameters
task_idA user defined ID of the Task.
jobThe Job to execute.
argumentsPointer to the arguments.
resultsPointer to the results.
attributesAttributes of the Task
template<typename ARGS , typename RES >
Task embb::mtapi::Group::Start ( mtapi_task_id_t  task_id,
Job const &  job,
const ARGS *  arguments,
RES *  results 
)

Starts a new Task in this Group.

Returns
The handle to the started Task.
Concurrency
Thread-safe
Parameters
task_idA user defined ID of the Task.
jobThe Job to execute.
argumentsPointer to the arguments.
resultsPointer to the results.
template<typename ARGS , typename RES >
Task embb::mtapi::Group::Start ( Job const &  job,
const ARGS *  arguments,
RES *  results,
TaskAttributes const &  attributes 
)

Starts a new Task in this Group.

Returns
The handle to the started Task.
Concurrency
Thread-safe
Parameters
jobThe Job to execute.
argumentsPointer to the arguments.
resultsPointer to the results.
attributesAttributes of the Task
template<typename ARGS , typename RES >
Task embb::mtapi::Group::Start ( Job const &  job,
const ARGS *  arguments,
RES *  results 
)

Starts a new Task in this Group.

Returns
The handle to the started Task.
Concurrency
Thread-safe
Parameters
jobThe Job to execute.
argumentsPointer to the arguments.
resultsPointer to the results.
mtapi_status_t embb::mtapi::Group::WaitAny ( mtapi_timeout_t  timeout,
void **  result 
)

Waits for any Task in the Group to finish for timeout milliseconds and retrieves the result buffer given in Start().

Returns
The status of the Task that finished execution, MTAPI_TIMEOUT or MTAPI_ERR_*
Concurrency
Thread-safe
Parameters
[in]timeoutTimeout duration in milliseconds
[out]resultThe result buffer given in Node::Start, Group::Start or Queue::Enqueue
mtapi_status_t embb::mtapi::Group::WaitAny ( void **  result)

Waits for any Task in the Group to finish and retrieves the result buffer given in Start().

Returns
The status of the Task that finished execution or MTAPI_ERR_*
Concurrency
Thread-safe
Parameters
[out]resultThe result buffer given in Node::Start, Group::Start or Queue::Enqueue
mtapi_status_t embb::mtapi::Group::WaitAny ( mtapi_timeout_t  timeout)

Waits for any Task in the Group to finish for timeout milliseconds.

Returns
The status of the Task that finished execution
Concurrency
Thread-safe
Parameters
[in]timeoutTimeout duration in milliseconds
mtapi_status_t embb::mtapi::Group::WaitAny ( )

Waits for any Task in the Group to finish.

Returns
The status of the Task that finished execution
Concurrency
Thread-safe
mtapi_status_t embb::mtapi::Group::WaitAll ( mtapi_timeout_t  timeout)

Waits for all Task in the Group to finish for timeout milliseconds.

Returns
MTAPI_SUCCESS, MTAPI_TIMEOUT, MTAPI_ERR_* or the status of any failed Task
Concurrency
Thread-safe
Parameters
[in]timeoutTimeout duration in milliseconds
mtapi_status_t embb::mtapi::Group::WaitAll ( )

Waits for all Task in the Group to finish.

Returns
MTAPI_SUCCESS, MTAPI_TIMEOUT, MTAPI_ERR_* or the status of any failed Task
Concurrency
Thread-safe
mtapi_group_hndl_t embb::mtapi::Group::GetInternal ( ) const

Returns the internal representation of this object.

Allows for interoperability with the C interface.

Returns
The internal mtapi_group_hndl_t.
Concurrency
Thread-safe and wait-free