|
Lightweight 0.20260617.0
|
#include <ThreadOffloadBackend.hpp>
Public Member Functions | |
| ThreadOffloadBackend (IExecutor &dbWorkers, IResumeScheduler &resume) | |
| StrandExecutor & | Strand () noexcept override |
| IResumeScheduler & | ResumeScheduler () noexcept override |
Public Member Functions inherited from Lightweight::Async::IAsyncBackend | |
| IAsyncBackend (IAsyncBackend const &)=delete | |
| IAsyncBackend & | operator= (IAsyncBackend const &)=delete |
| IAsyncBackend (IAsyncBackend &&)=delete | |
| IAsyncBackend & | operator= (IAsyncBackend &&)=delete |
Portable async backend that offloads blocking ODBC work to a worker thread.
Every blocking operation for the connection runs on a per-connection StrandExecutor (so the connection is serialized), and the awaiting coroutine resumes on the injected resume scheduler. This backend works with every ODBC driver on every platform and is the fallback whenever native driver async is unavailable.
This type is header-only (all members are inline), so it is intentionally not marked with the DLL export macro.
Definition at line 20 of file ThreadOffloadBackend.hpp.
|
inline |
Constructs the backend.
| dbWorkers | The shared worker-thread pool that actually runs blocking work. |
| resume | The scheduler used to resume coroutines (typically the app run loop). |
noexcept: constructing the strand allocates its shared state. Definition at line 28 of file ThreadOffloadBackend.hpp.
|
inlineoverridevirtualnoexcept |
The serializing executor for this connection; blocking work is offloaded here so the connection's ODBC handle is only ever touched by one thread at a time.
Implements Lightweight::Async::IAsyncBackend.
Definition at line 34 of file ThreadOffloadBackend.hpp.
|
inlineoverridevirtualnoexcept |
The scheduler used to resume coroutines after a blocking step completes (typically the application's run loop).
Implements Lightweight::Async::IAsyncBackend.
Definition at line 39 of file ThreadOffloadBackend.hpp.