Worker-safe work item; never retain Application, UI references, callbacks or coroutine frames. Inputs, callable captures and deleters must be safe on any releasing worker. The owner must impose domain byte limits separately. Cooperative cancellation cannot interrupt arbitrary blocking code.
More...
#include <background.hpp>
|
|
virtual | ~BackgroundJob ()=default |
| | Release worker-safe owning input and prepared result.
|
| virtual void | run (std::stop_token stop) noexcept=0 |
| virtual std::expected< void, AsyncError > | publish ()=0 |
|
void | requestStop () noexcept |
| | Request cancellation without joining. Registered stop callbacks run synchronously and must be short.
|
| std::stop_token | stopToken () const noexcept |
Worker-safe work item; never retain Application, UI references, callbacks or coroutine frames. Inputs, callable captures and deleters must be safe on any releasing worker. The owner must impose domain byte limits separately. Cooperative cancellation cannot interrupt arbitrary blocking code.
◆ publish()
| virtual std::expected< void, AsyncError > portals::BackgroundJob::publish |
( |
| ) |
|
|
pure virtual |
- Returns
- Success after publication; WOULD_BLOCK/NO_MEMORY retain the same prepared result for retry. CLOSED/CANCELLED retire it. Called on a worker, never under the pool mutex.
◆ run()
| virtual void portals::BackgroundJob::run |
( |
std::stop_token | stop | ) |
|
|
pure virtualnoexcept |
- Parameters
-
| stop | This job's cooperative cancellation signal. Run once outside the UI. Overrides must contain their exceptions and prepare a typed result. |
◆ stopToken()
| std::stop_token portals::BackgroundJob::stopToken |
( |
| ) |
const |
|
noexcept |
- Returns
- This item's cooperative cancellation signal, safe to copy across threads.
The documentation for this class was generated from the following file: