![]() |
alpaka
Abstraction Library for Parallel Kernel Acceleration
|
A thread queue executing tasks asynchronously. More...
#include <CallbackThread.hpp>
Classes | |
| struct | FunctionHolder |
| struct | State |
| struct | Task |
Public Member Functions | |
| CallbackThread () | |
| CallbackThread (uint32_t cpuGroupIdx) | |
| ~CallbackThread () | |
| bool | isEmpty () const |
| template<typename NullaryFunction> | |
| auto | submit (NullaryFunction &&nf) -> std::future< void > |
| It is guaranteed that the task is fully destroyed before the future's result is set. | |
Private Types | |
| using | TaskPackage = std::pair<std::unique_ptr<Task>, std::promise<void>> |
Private Member Functions | |
| auto | startWorkerThread () -> void |
Private Attributes | |
| uint32_t | m_cpuGroupIdx = onHost::internal::hwloc::allDomains |
| std::shared_ptr< State > | m_state |
| Hold data shared between this call and the thread processing the tasts. | |
| std::jthread | m_thread |
A thread queue executing tasks asynchronously.
This object should be used as a member of objects which are secured by smart pointers to avoid that a task is taking over the ownership of the callback thread and therefore can destroy itself before all tasks are executed.
Definition at line 26 of file CallbackThread.hpp.
|
private |
Definition at line 61 of file CallbackThread.hpp.
|
inline |
Definition at line 71 of file CallbackThread.hpp.
|
inline |
Definition at line 75 of file CallbackThread.hpp.
|
inline |
Definition at line 79 of file CallbackThread.hpp.
|
inline |
Definition at line 129 of file CallbackThread.hpp.
|
inlineprivate |
Definition at line 141 of file CallbackThread.hpp.
|
inline |
It is guaranteed that the task is fully destroyed before the future's result is set.
Definition at line 105 of file CallbackThread.hpp.
|
private |
Definition at line 139 of file CallbackThread.hpp.
|
private |
Hold data shared between this call and the thread processing the tasts.
Definition at line 138 of file CallbackThread.hpp.
|
private |
Definition at line 136 of file CallbackThread.hpp.