#include <GpuExecutionOwner.hpp>
|
| static std::shared_ptr< GpuExecutionOwner > | shared () |
| | Acquire the process-resident controlling thread for matched GPU plugins.
|
| |
◆ GpuExecutionOwner() [1/2]
| openswmm::twoD::GpuExecutionOwner::GpuExecutionOwner |
( |
| ) |
|
|
inline |
Start a dedicated synchronous-dispatch worker.
- Postcondition
- Constructs an empty queue and a worker running work(). Thread creation may throw std::system_error; no partially live owner is returned.
- Note
- Normally use shared(). This constructor does not initialize Kokkos or load a plugin.
◆ ~GpuExecutionOwner()
| openswmm::twoD::GpuExecutionOwner::~GpuExecutionOwner |
( |
| ) |
|
|
inline |
Stop and join a nonresident execution owner after queued work drains.
- Precondition
- No concurrent or later invoke() calls; destructor must run outside its worker thread. Never destroy under a DLL loader lock.
- Postcondition
- Sets stopping, wakes the worker, drains already queued tasks and joins it. Process-resident shared() instances intentionally avoid teardown-time destruction.
◆ GpuExecutionOwner() [2/2]
◆ invoke()
template<class F>
| auto openswmm::twoD::GpuExecutionOwner::invoke |
( |
F && | fn | ) |
-> std::invoke_result_t<F> |
|
inline |
Execute one callable on the controlling thread and wait for completion.
- Template Parameters
-
| F | Callable type; must be invocable with no arguments. |
- Parameters
-
| [in] | fn | Forwarded callable, moved/copied into an owned queued task; captures may borrow buffers only until invoke returns. |
- Returns
- Callable result, including void/reference results according to std::invoke_result_t<F>. Exceptions from the callable are rethrown through the future; allocation/queue failures may also propagate.
- Note
- Reentrant calls from the worker execute inline. Other callers enqueue under a mutex and block; queued calls are serialized. Owner must remain alive, and destruction must not race this call. Does not retain caller buffers after the synchronous result is delivered.
◆ shared()
| static std::shared_ptr< GpuExecutionOwner > openswmm::twoD::GpuExecutionOwner::shared |
( |
| ) |
|
|
inlinestatic |
Acquire the process-resident controlling thread for matched GPU plugins.
- Returns
- Shared ownership handle to the one intentionally resident owner; a static allocation retains it through process teardown.
- Note
- First use allocates and starts a thread and may throw. Factory must pin the containing module before first use, avoiding thread join under the Windows loader lock. Later acquisitions are synchronized by C++ static initialization.
The documentation for this class was generated from the following file: