зеркало из https://github.com/microsoft/cppwinrt.git
bf4459b25a
`resume_agile` exposes the ability to save the `await_adapter` in a variable. This was not possible without `resume_agile` because the `await_adapter` had previously been available only via `operator co_await`, which means that it is created only in response to an immediate attempt to `co_await` it, so we knew that it would be consumed before its argument (possibly a temporary) was destructed. `resume_agile` returns the `await_adapter`, and we expect people to await it immediately, but it's possible that they decide to save it in a variable and await it later. In that case, we have to record the `Async` as a value instead of a reference. We forward the `resume_agile` argument into the `Async` so that it moves if given an rvalue reference, or copies if given an lvalue reference. This ensure that the common case where somebody does `co_await resume_agile(DoSomething())`, we do not incur any additional AddRefs or Releases. Now that it's possible to `co_await` the `await_adapter` twice, we have to worry about `await_suspend` being called twice. It had previously assumed that `suspending` was true (since that's how it was constructed), but that is no longer valid in the `resume_agile` case if somebody tries to await the `resume_agile` twice. So we have to force it to `true`. (Now, the second await will fail with "illegal delegate assignment", but our failure to set `suspending` to `true` led to double-resumption, which is super-bad.) |
||
---|---|---|
.. | ||
base_abi.h | ||
base_activation.h | ||
base_agile_ref.h | ||
base_array.h | ||
base_chrono.h | ||
base_collections.h | ||
base_collections_base.h | ||
base_collections_input_iterable.h | ||
base_collections_input_map.h | ||
base_collections_input_map_view.h | ||
base_collections_input_vector.h | ||
base_collections_input_vector_view.h | ||
base_collections_map.h | ||
base_collections_vector.h | ||
base_com_ptr.h | ||
base_composable.h | ||
base_coroutine_foundation.h | ||
base_coroutine_system.h | ||
base_coroutine_system_winui.h | ||
base_coroutine_threadpool.h | ||
base_coroutine_ui_core.h | ||
base_deferral.h | ||
base_delegate.h | ||
base_error.h | ||
base_events.h | ||
base_extern.h | ||
base_fast_forward.h | ||
base_foundation.h | ||
base_handle.h | ||
base_identity.h | ||
base_implements.h | ||
base_includes.h | ||
base_iterator.h | ||
base_lock.h | ||
base_macros.h | ||
base_marshaler.h | ||
base_meta.h | ||
base_natvis.h | ||
base_reference_produce.h | ||
base_reference_produce_1.h | ||
base_security.h | ||
base_std_hash.h | ||
base_string.h | ||
base_string_input.h | ||
base_string_operators.h | ||
base_stringable_format.h | ||
base_stringable_format_1.h | ||
base_stringable_streams.h | ||
base_stringable_to_hstring.h | ||
base_types.h | ||
base_version.h | ||
base_version_odr.h | ||
base_weak_ref.h | ||
base_windows.h | ||
base_xaml_component_connector.h | ||
base_xaml_component_connector_winui.h | ||
base_xaml_typename.h |