MCPcopy Create free account
hub / github.com/NVIDIA/stdexec / __try_start

Function __try_start

include/exec/detail/shared.hpp:368–390  ·  view source on GitHub ↗

@post The `__started_` atomic flag is set in the shared state's ref count, OR the __waiters_ list is set to the known "tombstone" value indicating completion.

Source from the content-addressed store, hash-verified

366 /// @post The `__started_` atomic flag is set in the shared state's ref count, OR the
367 /// __waiters_ list is set to the known "tombstone" value indicating completion.
368 void __try_start() noexcept
369 {
370 // With the split algorithm, multiple split senders can be started simultaneously,
371 // but only one should start the shared async operation. If __set_started() reports
372 // that the operation has already been started, do nothing.
373 if (this->__set_started())
374 {
375 // we are the first to start the underlying operation
376 if (this->__stop_source_.stop_requested())
377 {
378 // Stop has already been requested. Rather than starting the operation, complete with
379 // set_stopped immediately.
380 // 1. Sets __waiters_ to a known "tombstone" value.
381 // 2. Notifies all the waiters that the operation has stopped.
382 // 3. Sets the "is running" bit in the ref count to 0.
383 this->__notify_waiters();
384 }
385 else
386 {
387 STDEXEC::start(__shared_op_);
388 }
389 }
390 }
391
392 template <class _StopToken>
393 auto __try_add_waiter(__local_state_base* __waiter, _StopToken __stok) noexcept -> bool

Callers

nothing calls this directly

Calls 2

startFunction · 0.50
stop_requestedMethod · 0.45

Tested by

no test coverage detected