11
22namespace winrt ::impl
33{
4- inline auto resume_background (std::experimental::coroutine_handle<> handle)
4+ inline void __stdcall resume_background_callback ( void *, void * context) noexcept
55 {
6- auto callback = [](void *, void * context) noexcept
7- {
8- std::experimental::coroutine_handle<>::from_address (context)();
9- };
6+ std::experimental::coroutine_handle<>::from_address (context)();
7+ };
108
11- if (!WINRT_TrySubmitThreadpoolCallback (callback, handle.address (), nullptr ))
9+ inline auto resume_background (std::experimental::coroutine_handle<> handle)
10+ {
11+ if (!WINRT_TrySubmitThreadpoolCallback (resume_background_callback, handle.address (), nullptr ))
1212 {
1313 throw_last_error ();
1414 }
@@ -26,20 +26,20 @@ namespace winrt::impl
2626 return is_sta () ? capture<IContextCallback>(WINRT_CoGetObjectContext) : nullptr ;
2727 }
2828
29+ inline int32_t __stdcall resume_apartment_callback (com_callback_args* args) noexcept
30+ {
31+ std::experimental::coroutine_handle<>::from_address (args->data )();
32+ return 0 ;
33+ };
34+
2935 inline auto resume_apartment (com_ptr<IContextCallback> const & sta_context, std::experimental::coroutine_handle<> handle)
3036 {
3137 if (sta_context)
3238 {
3339 com_callback_args args{};
3440 args.data = handle.address ();
3541
36- auto callback = [](com_callback_args* args) noexcept -> int32_t
37- {
38- std::experimental::coroutine_handle<>::from_address (args->data )();
39- return 0 ;
40- };
41-
42- check_hresult (sta_context->ContextCallback (callback, &args, guid_of<ICallbackWithNoReentrancyToApplicationSTA>(), 5 , nullptr ));
42+ check_hresult (sta_context->ContextCallback (resume_apartment_callback, &args, guid_of<ICallbackWithNoReentrancyToApplicationSTA>(), 5 , nullptr ));
4343 }
4444 else
4545 {
0 commit comments