Lightweight 0.20260617.0
Loading...
Searching...
No Matches
Lightweight::Async::ThreadOffloadBackend Class Referencefinal

#include <ThreadOffloadBackend.hpp>

Inheritance diagram for Lightweight::Async::ThreadOffloadBackend:
Lightweight::Async::IAsyncBackend

Public Member Functions

 ThreadOffloadBackend (IExecutor &dbWorkers, IResumeScheduler &resume)
 
StrandExecutorStrand () noexcept override
 
IResumeSchedulerResumeScheduler () noexcept override
 
- Public Member Functions inherited from Lightweight::Async::IAsyncBackend
 IAsyncBackend (IAsyncBackend const &)=delete
 
IAsyncBackendoperator= (IAsyncBackend const &)=delete
 
 IAsyncBackend (IAsyncBackend &&)=delete
 
IAsyncBackendoperator= (IAsyncBackend &&)=delete
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ThreadOffloadBackend()

Lightweight::Async::ThreadOffloadBackend::ThreadOffloadBackend ( IExecutor dbWorkers,
IResumeScheduler resume 
)
inline

Constructs the backend.

Parameters
dbWorkersThe shared worker-thread pool that actually runs blocking work.
resumeThe scheduler used to resume coroutines (typically the app run loop).
Note
Not noexcept: constructing the strand allocates its shared state.

Definition at line 28 of file ThreadOffloadBackend.hpp.

Member Function Documentation

◆ Strand()

StrandExecutor & Lightweight::Async::ThreadOffloadBackend::Strand ( )
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.

◆ ResumeScheduler()

IResumeScheduler & Lightweight::Async::ThreadOffloadBackend::ResumeScheduler ( )
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.


The documentation for this class was generated from the following file: