Work-unit budget, workspace-estimate gate and cancellation poll for one operation.
More...
#include </home/runner/work/Meshkit/Meshkit/src/native/operation.hpp>
|
| | Work (const Limits &l, const std::function< bool()> &c) |
| | Bind the limits and poll, set the allowance, and poll cancellation once.
|
| |
| void | check () const |
| | Poll the cancellation callback.
|
| |
| void | tick (std::uint64_t count=1) |
| | Charge work units; cancellation is polled whenever the updated total is an exact multiple of 4096.
|
| |
| void | memoryFor (std::initializer_list< std::pair< std::uint64_t, std::uint64_t > > terms) const |
| | Gate a workspace estimate given as (count, bytes per item) terms.
|
| |
| void | memory (std::uint64_t estimate) const |
| | Gate one workspace estimate; nothing is allocated or recorded.
|
| |
Work-unit budget, workspace-estimate gate and cancellation poll for one operation.
Holds references to the caller's limits and callback, which must outlive it. Not thread-safe: one operation thread updates it.
◆ Work()
| meshkit::native_detail::Work::Work |
( |
const Limits & | l, |
|
|
const std::function< bool()> & | c ) |
|
inline |
Bind the limits and poll, set the allowance, and poll cancellation once.
- Parameters
-
| [in] | l | Limits, borrowed for the object's lifetime. |
| [in] | c | Cancellation callback, borrowed for the object's lifetime; may be empty. |
- Exceptions
-
| Stop | cancelled (status Cancelled) when the poll already returns true. |
◆ check()
| void meshkit::native_detail::Work::check |
( |
| ) |
const |
|
inline |
Poll the cancellation callback.
- Exceptions
-
| Stop | cancelled (status Cancelled) when the callback is set and returns true. |
◆ memory()
| void meshkit::native_detail::Work::memory |
( |
std::uint64_t | estimate | ) |
const |
|
inline |
Gate one workspace estimate; nothing is allocated or recorded.
- Parameters
-
| [in] | estimate | Estimated bytes. |
- Exceptions
-
◆ memoryFor()
| void meshkit::native_detail::Work::memoryFor |
( |
std::initializer_list< std::pair< std::uint64_t, std::uint64_t > > | terms | ) |
const |
|
inline |
Gate a workspace estimate given as (count, bytes per item) terms.
- Parameters
-
| [in] | terms | Pairs whose products are summed; nothing is allocated or recorded. |
- Exceptions
-
◆ tick()
| void meshkit::native_detail::Work::tick |
( |
std::uint64_t | count = 1 | ) |
|
|
inline |
Charge work units; cancellation is polled whenever the updated total is an exact multiple of 4096.
- Parameters
-
- Exceptions
-
| Stop | work_limit (status ResourceLimit), leaving used unchanged, when the charge would exceed maximum; Stop cancelled from check(). |
◆ cancelled
| const std::function<bool()>& meshkit::native_detail::Work::cancelled |
Borrowed cancellation poll; may be empty.
◆ limits
| const Limits& meshkit::native_detail::Work::limits |
Borrowed limits; maxWorkspaceBytes gates memory().
◆ maximum
| std::uint64_t meshkit::native_detail::Work::maximum = 0 |
◆ used
| std::uint64_t meshkit::native_detail::Work::used = 0 |
The documentation for this struct was generated from the following file: