cuda::experimental::stf::sump::retry_t#

struct retry_t#

The unit re-attempt: re-runs the callable once; if the re-run throws, passes that exception through.

Counts come from repetition, retry * 3 re-attempts up to three times and retry * 3 | subst(fallback) answers the spent failure, or from a count in one policy: retry(3), or retry(forever) until the action succeeds. retry alone is retry * 1.

Answers __fn()’s value for a non-void callable, or std::ignore after a successful re-run of a void callable. A re-attempt chooses a value, so it cannot stand on the left of &: retry & subst(0) is rejected, and retry | subst(0) is the fallback after one re-run.

On the code channel the re-run’s status decides: a success is handled, a failure passes through, carrying the latest status. A past result has no action to re-run, so retry on a status operand is rejected at compile time.

Public Functions

template<class _Fn>
inline decltype(auto) on_thrown(
const ::std::exception*,
const ::cuda::std::source_location,
_Fn &__fn
)#
template<class _Status, class _Fn>
inline detail::__status_answer<_Status> on_returned(
const _Status __status,
const ::cuda::std::source_location,
_Fn &__fn
) const#

The code-channel hook: one re-run of a status-returning action.

inline detail::__retry_n_t operator()(const int __n) const#

Up to __n re-attempts in one policy; exhaustion passes the last failure through.

Parameters:

__n – [in] The number of re-attempts, non-negative.

Returns:

The counted re-attempt policy.

inline detail::__retry_n_t operator()(forever_t) const noexcept#

Re-attempts until the action succeeds.

Returns:

The unbounded re-attempt policy.