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

Method notify

include/exec/when_any.hpp:101–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99
100 template <class _Tag, class... _Args>
101 void notify(_Tag, _Args&&... __args) noexcept
102 {
103 using __result_t = __decayed_tuple<_Tag, _Args...>;
104 bool __expect = false;
105 if (__emplaced_.compare_exchange_strong(__expect,
106 true,
107 __std::memory_order_relaxed,
108 __std::memory_order_relaxed))
109 {
110 // This emplacement can happen only once
111 if constexpr ((__nothrow_decay_copyable<_Args> && ...))
112 {
113 __result_.template emplace<__result_t>(_Tag{}, static_cast<_Args&&>(__args)...);
114 }
115 else
116 {
117 STDEXEC_TRY
118 {
119 __result_.template emplace<__result_t>(_Tag{}, static_cast<_Args&&>(__args)...);
120 }
121 STDEXEC_CATCH_ALL
122 {
123 using __error_t = __tuple<set_error_t, std::exception_ptr>;
124 __result_.template emplace<__error_t>(set_error_t{}, std::current_exception());
125 }
126 }
127 // stop pending operations
128 __stop_source_.request_stop();
129 }

Callers 3

set_valueMethod · 0.45
set_errorMethod · 0.45
set_stoppedMethod · 0.45

Calls 1

Tested by

no test coverage detected