@@ -85,21 +85,24 @@ namespace winrt::impl
8585 check_hresult (context->ContextCallback (resume_apartment_callback, &args, guid_of<ICallbackWithNoReentrancyToApplicationSTA>(), 5 , nullptr ));
8686 }
8787
88+ struct threadpool_resume
89+ {
90+ threadpool_resume (com_ptr<IContextCallback> const & context, coroutine_handle<> handle) :
91+ m_context (context), m_handle(handle) { }
92+ com_ptr<IContextCallback> m_context;
93+ coroutine_handle<> m_handle;
94+ };
95+
96+ inline void __stdcall fallback_submit_threadpool_callback (void *, void * p) noexcept
97+ {
98+ std::unique_ptr<threadpool_resume> state{ static_cast <threadpool_resume*>(p) };
99+ resume_apartment_sync (state->m_context , state->m_handle );
100+ }
101+
88102 inline void resume_apartment_on_threadpool (com_ptr<IContextCallback> const & context, coroutine_handle<> handle)
89103 {
90- struct threadpool_resume
91- {
92- threadpool_resume (com_ptr<IContextCallback> const & context, coroutine_handle<> handle) :
93- m_context (context), m_handle(handle) { }
94- com_ptr<IContextCallback> m_context;
95- coroutine_handle<> m_handle;
96- };
97104 auto state = std::make_unique<threadpool_resume>(context, handle);
98- submit_threadpool_callback ([](void *, void * p)
99- {
100- std::unique_ptr<threadpool_resume> state{ static_cast <threadpool_resume*>(p) };
101- resume_apartment_sync (state->m_context , state->m_handle );
102- }, state.get ());
105+ submit_threadpool_callback (fallback_submit_threadpool_callback, state.get ());
103106 state.release ();
104107 }
105108
0 commit comments