From 4e19dcc8a73b3d0d6539677ceac944494d6200af Mon Sep 17 00:00:00 2001 From: arthur Date: Fri, 12 Mar 2021 16:39:40 +0100 Subject: [PATCH 1/3] Fix compile clang x86 for base coroutine thread pool - Fixes #879 --- strings/base_coroutine_threadpool.h | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/strings/base_coroutine_threadpool.h b/strings/base_coroutine_threadpool.h index 7cdeb9514..6537018d9 100644 --- a/strings/base_coroutine_threadpool.h +++ b/strings/base_coroutine_threadpool.h @@ -85,21 +85,26 @@ namespace winrt::impl check_hresult(context->ContextCallback(resume_apartment_callback, &args, guid_of(), 5, nullptr)); } + struct threadpool_resume + { + threadpool_resume(com_ptr const& context, coroutine_handle<> handle) : + m_context(context), m_handle(handle) { } + com_ptr m_context; + coroutine_handle<> m_handle; + }; + + inline void __stdcall fallback_submit_threadpool_callback(void*, + void* p) noexcept + { + std::unique_ptr state{ static_cast( + p) }; + resume_apartment_sync(state->m_context, state->m_handle); + } + inline void resume_apartment_on_threadpool(com_ptr const& context, coroutine_handle<> handle) { - struct threadpool_resume - { - threadpool_resume(com_ptr const& context, coroutine_handle<> handle) : - m_context(context), m_handle(handle) { } - com_ptr m_context; - coroutine_handle<> m_handle; - }; auto state = std::make_unique(context, handle); - submit_threadpool_callback([](void*, void* p) - { - std::unique_ptr state{ static_cast(p) }; - resume_apartment_sync(state->m_context, state->m_handle); - }, state.get()); + submit_threadpool_callback(fallback_submit_threadpool_callback, state.get()); state.release(); } From 8a1723fd9e1fcfbc61416ab6e879bbe1ea6a71bf Mon Sep 17 00:00:00 2001 From: Arthur Biancarelli Date: Fri, 12 Mar 2021 17:01:42 +0100 Subject: [PATCH 2/3] Update strings/base_coroutine_threadpool.h Co-authored-by: Kenny Kerr --- strings/base_coroutine_threadpool.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/strings/base_coroutine_threadpool.h b/strings/base_coroutine_threadpool.h index 6537018d9..0b4b8d06c 100644 --- a/strings/base_coroutine_threadpool.h +++ b/strings/base_coroutine_threadpool.h @@ -93,8 +93,7 @@ namespace winrt::impl coroutine_handle<> m_handle; }; - inline void __stdcall fallback_submit_threadpool_callback(void*, - void* p) noexcept + inline void __stdcall fallback_submit_threadpool_callback(void*, void* p) noexcept { std::unique_ptr state{ static_cast( p) }; From 9fa72d54b2edb90b56b77b56f5d24f74dab5faa2 Mon Sep 17 00:00:00 2001 From: Arthur Biancarelli Date: Fri, 12 Mar 2021 17:01:47 +0100 Subject: [PATCH 3/3] Update strings/base_coroutine_threadpool.h Co-authored-by: Kenny Kerr --- strings/base_coroutine_threadpool.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/strings/base_coroutine_threadpool.h b/strings/base_coroutine_threadpool.h index 0b4b8d06c..699c39eef 100644 --- a/strings/base_coroutine_threadpool.h +++ b/strings/base_coroutine_threadpool.h @@ -95,8 +95,7 @@ namespace winrt::impl inline void __stdcall fallback_submit_threadpool_callback(void*, void* p) noexcept { - std::unique_ptr state{ static_cast( - p) }; + std::unique_ptr state{ static_cast(p) }; resume_apartment_sync(state->m_context, state->m_handle); }