| 308 | stop_callback_for_t<stop_token_of_t<env_of_t<_Receiver>>, __forward_stopped>; |
| 309 | |
| 310 | constexpr void __complete_() noexcept |
| 311 | { |
| 312 | STDEXEC_TRY |
| 313 | { |
| 314 | __forward_consumer_.reset(); |
| 315 | auto __state = std::move(__state_); |
| 316 | STDEXEC_ASSERT(__state != nullptr); |
| 317 | std::unique_lock __guard{__state->__mutex_}; |
| 318 | // either the future is still in use or it has passed ownership to __state->__no_future_ |
| 319 | if (__state->__no_future_.get() != nullptr || __state->__step_ != __future_step::__future) |
| 320 | { |
| 321 | // invalid state - there is a code bug in the state machine |
| 322 | std::terminate(); |
| 323 | } |
| 324 | else if (get_stop_token(get_env(__rcvr_)).stop_requested()) |
| 325 | { |
| 326 | __guard.unlock(); |
| 327 | STDEXEC::set_stopped(static_cast<_Receiver&&>(__rcvr_)); |
| 328 | __guard.lock(); |
| 329 | } |
| 330 | else |
| 331 | { |
| 332 | std::visit( |
| 333 | [this, &__guard]<class _Tup>(_Tup& __tup) |
| 334 | { |
| 335 | if constexpr (__std::same_as<_Tup, std::monostate>) |
| 336 | { |
| 337 | std::terminate(); |
| 338 | } |
| 339 | else |
| 340 | { |
| 341 | std::apply( |
| 342 | [this, &__guard]<class... _As>(auto tag, _As&... __as) |
| 343 | { |
| 344 | __guard.unlock(); |
| 345 | tag(static_cast<_Receiver&&>(__rcvr_), static_cast<_As&&>(__as)...); |
| 346 | __guard.lock(); |
| 347 | }, |
| 348 | __tup); |
| 349 | } |
| 350 | }, |
| 351 | __state->__data_); |
| 352 | } |
| 353 | } |
| 354 | STDEXEC_CATCH_ALL |
| 355 | { |
| 356 | STDEXEC::set_error(static_cast<_Receiver&&>(__rcvr_), std::current_exception()); |
no test coverage detected