| 82 | {} |
| 83 | |
| 84 | void start() & noexcept |
| 85 | { |
| 86 | // must get lock before checking __active, or if the __active is drained before |
| 87 | // the waiter is queued but after __active is checked, the waiter will never be notified |
| 88 | std::unique_lock __guard{this->__scope_->__lock_}; |
| 89 | auto& __active = this->__scope_->__active_; |
| 90 | auto& __waiters = this->__scope_->__waiters_; |
| 91 | if (__active.load(__std::memory_order_acquire) != 0) |
| 92 | { |
| 93 | __waiters.push_back(this); |
| 94 | return; |
| 95 | } |
| 96 | __guard.unlock(); |
| 97 | STDEXEC::start(this->__op_); |
| 98 | } |
| 99 | |
| 100 | private: |
| 101 | static constexpr void __notify_waiter(__task* __self) noexcept |