Embedded Multicore Building Blocks V1.0.0
|
Represents a thread of execution. More...
#include <thread.h>
Classes | |
class | ID |
Unique ID of a thread that can be compared with other IDs. More... | |
Public Member Functions | |
template<typename Function > | |
Thread (Function function) | |
Creates and runs a thread with zero-argument start function. More... | |
template<typename Function > | |
Thread (CoreSet &core_set, Function function) | |
Creates and runs a thread with zero-argument start function. More... | |
template<typename Function > | |
Thread (CoreSet &core_set, embb_thread_priority_t priority, Function function) | |
Creates and runs a thread with zero-argument start function. More... | |
template<typename Function , typename Arg > | |
Thread (Function function, Arg arg) | |
Creates and runs a thread with one-argument thread start function. More... | |
template<typename Function , typename Arg1 , typename Arg2 > | |
Thread (Function function, Arg1 arg1, Arg2 arg2) | |
Creates and runs a thread with two-argument thread start function. More... | |
void | Join () |
Waits until the thread has finished execution. More... | |
ID | GetID () |
Returns the thread ID. More... | |
Static Public Member Functions | |
static unsigned int | GetThreadsMaxCount () |
Returns the maximum number of threads handled by EMB2. More... | |
static void | SetThreadsMaxCount (unsigned int max_count) |
Sets the maximum number of threads handled by EMB2. More... | |
static ID | CurrentGetID () |
Returns the ID of the current thread. More... | |
static void | CurrentYield () |
Reschedule the current thread for later execution. More... | |
Represents a thread of execution.
Provides an abstraction from platform-specific threading implementations to create, manage, and join threads of execution. Support for thread-to-core affinities is given on thread creation by using the core set functionality.
This class is essentially a wrapper for the underlying C implementation.
|
explicit |
Creates and runs a thread with zero-argument start function.
NoMemoryException | if not enough memory is available |
ErrorException | in case of another error |
[in] | function | Copyable function object, callable without arguments |
Creates and runs a thread with zero-argument start function.
NoMemoryException | if not enough memory is available |
ErrorException | in case of another error |
[in] | core_set | Set of cores on which the thread shall be executed. |
[in] | function | Copyable function object, callable without arguments |
embb::base::Thread::Thread | ( | CoreSet & | core_set, |
embb_thread_priority_t | priority, | ||
Function | function | ||
) |
Creates and runs a thread with zero-argument start function.
NoMemoryException | if not enough memory is available |
ErrorException | in case of another error |
[in] | core_set | Set of cores on which the thread shall be executed. |
[in] | priority | Priority of the new thread. |
[in] | function | Copyable function object, callable without arguments |
embb::base::Thread::Thread | ( | Function | function, |
Arg | arg | ||
) |
Creates and runs a thread with one-argument thread start function.
NoMemoryException | if not enough memory is available |
ErrorException | in case of another error |
[in] | function | Copyable function object, callable with one argument |
[in] | arg | Argument for function (must be copyable) |
embb::base::Thread::Thread | ( | Function | function, |
Arg1 | arg1, | ||
Arg2 | arg2 | ||
) |
Creates and runs a thread with two-argument thread start function.
NoMemoryException | if not enough memory is available |
ErrorException | in case of another error |
Function | Function object type |
Arg1 | Type of first argument |
Arg2 | Type of second argument |
[in] | function | Copyable function object, callable with two arguments |
[in] | arg1 | First argument for function (must be copyable) |
[in] | arg2 | Second argument for function (must be copyable) |
|
static |
Returns the maximum number of threads handled by EMB2.
See embb_thread_get_max_count() for a description of the semantics.
|
static |
Sets the maximum number of threads handled by EMB2.
[in] | max_count | Maximum number of threads |
|
static |
Returns the ID of the current thread.
The ID is only valid within the calling thread.
|
static |
Reschedule the current thread for later execution.
This is only a request, the realization depends on the implementation and the scheduler employed by the operating system.
void embb::base::Thread::Join | ( | ) |
Waits until the thread has finished execution.
ID embb::base::Thread::GetID | ( | ) |
Returns the thread ID.