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

Describes the affinity of an Action or Task to a worker thread of a Node. More...

#include <affinity.h>

Public Member Functions

 Affinity ()
 Constructs an Affinity object. More...
 
 Affinity (Affinity const &other)
 Copies an Affinity object. More...
 
void operator= (Affinity const &other)
 Copies an Affinity object. More...
 
 Affinity (bool initial_affinity)
 Constructs an Affinity object with the given initial affinity. More...
 
void Init (bool initial_affinity)
 Initializes an Affinity object with the given initial affinity. More...
 
void Set (mtapi_uint_t worker, bool state)
 Sets affinity to the given worker. More...
 
bool Get (mtapi_uint_t worker)
 Gets affinity to the given worker. More...
 
mtapi_affinity_t GetInternal () const
 Returns the internal representation of this object. More...
 

Detailed Description

Describes the affinity of an Action or Task to a worker thread of a Node.

Constructor & Destructor Documentation

embb::mtapi::Affinity::Affinity ( )

Constructs an Affinity object.

Concurrency
Not thread-safe
embb::mtapi::Affinity::Affinity ( Affinity const &  other)

Copies an Affinity object.

Concurrency
Thread-safe and wait-free
Parameters
otherThe Affinity to copy from
embb::mtapi::Affinity::Affinity ( bool  initial_affinity)

Constructs an Affinity object with the given initial affinity.

If initial_affinity is true the Affinity will map to all worker threads, otherwise it will map to no worker threads.

Concurrency
Not thread-safe
Parameters
initial_affinityThe initial affinity to set.

Member Function Documentation

void embb::mtapi::Affinity::operator= ( Affinity const &  other)

Copies an Affinity object.

Concurrency
Thread-safe and wait-free
Parameters
otherThe Affinity to copy from
void embb::mtapi::Affinity::Init ( bool  initial_affinity)

Initializes an Affinity object with the given initial affinity.

If initial_affinity is true the Affinity will map to all worker threads, otherwise it will map to no worker threads.

Concurrency
Not thread-safe
Parameters
initial_affinityThe initial affinity to set.
void embb::mtapi::Affinity::Set ( mtapi_uint_t  worker,
bool  state 
)

Sets affinity to the given worker.

Concurrency
Not thread-safe
Parameters
workerThe worker to set affinity to.
stateThe state of the affinity.
bool embb::mtapi::Affinity::Get ( mtapi_uint_t  worker)

Gets affinity to the given worker.

Returns
true, if the Affinity maps to the worker, false otherwise.
Concurrency
Thread-safe and wait-free
Parameters
workerThe worker to get affinity of.
mtapi_affinity_t embb::mtapi::Affinity::GetInternal ( ) const

Returns the internal representation of this object.

Allows for interoperability with the C interface.

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