Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions strings/base_coroutine_threadpool.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

namespace winrt::impl
{
inline auto resume_background(std::experimental::coroutine_handle<> handle)
inline void __stdcall resume_background_callback(void*, void* context) noexcept
{
auto callback = [](void*, void* context) noexcept
{
std::experimental::coroutine_handle<>::from_address(context)();
};
std::experimental::coroutine_handle<>::from_address(context)();
};

if (!WINRT_TrySubmitThreadpoolCallback(callback, handle.address(), nullptr))
inline auto resume_background(std::experimental::coroutine_handle<> handle)
{
if (!WINRT_TrySubmitThreadpoolCallback(resume_background_callback, handle.address(), nullptr))
{
throw_last_error();
}
Expand All @@ -26,20 +26,20 @@ namespace winrt::impl
return is_sta() ? capture<IContextCallback>(WINRT_CoGetObjectContext) : nullptr;
}

inline int32_t __stdcall resume_apartment_callback(com_callback_args* args) noexcept
{
std::experimental::coroutine_handle<>::from_address(args->data)();
return 0;
};

inline auto resume_apartment(com_ptr<IContextCallback> const& sta_context, std::experimental::coroutine_handle<> handle)
{
if (sta_context)
{
com_callback_args args{};
args.data = handle.address();

auto callback = [](com_callback_args* args) noexcept -> int32_t
{
std::experimental::coroutine_handle<>::from_address(args->data)();
return 0;
};

check_hresult(sta_context->ContextCallback(callback, &args, guid_of<ICallbackWithNoReentrancyToApplicationSTA>(), 5, nullptr));
check_hresult(sta_context->ContextCallback(resume_apartment_callback, &args, guid_of<ICallbackWithNoReentrancyToApplicationSTA>(), 5, nullptr));
}
else
{
Expand Down