33 Execution control library [exec]

33.14 Execution scope utilities [exec.scope]

33.14.2 Counting Scopes [exec.counting.scopes]

33.14.2.2 Simple Counting Scope [exec.scope.simple.counting]

33.14.2.2.3 Members [exec.simple.counting.mem]

token get_token() noexcept;
Returns: An object t of type simple_counting_scope​::​token such that t.scope == this is true.
void close() noexcept;
Effects: If state is
  • unused, then changes state to unused-and-closed;
  • open, then changes state to closed;
  • open-and-joining, then changes state to closed-and-joining;
  • otherwise, no effects.
Postconditions: Any subsequent call to try-associate() on *this returns false.
sender auto join() noexcept;
Returns: make-sender(scope-join-t(), this).
bool try-associate() noexcept;
Effects: If count is equal to max_associations, then no effects.
Otherwise, if state is
  • unused, then increments count and changes state to open;
  • open or open-and-joining, then increments count;
  • otherwise, no effects.
Returns: true if count was incremented, false otherwise.
void disassociate() noexcept;
Preconditions: count is greater than zero.
Effects: Decrements count.
If count is zero after decrementing and state is open-and-joining or closed-and-joining, changes state to joined and calls complete() on all objects registered with *this.
[Note 1: 
Calling complete() on any registered object can cause *this to be destroyed.
— end note]
template<class State> bool start-join-sender(State& st) noexcept;
Effects: If state is
  • unused, unused-and-closed, or joined, then changes state to joined and returns true;
  • open or open-and-joining, then changes state to open-and-joining, registers st with *this and returns false;
  • closed or closed-and-joining, then changes state to closed-and-joining, registers st with *this and returns false.