@@ -433,9 +433,17 @@ WINRT_EXPORT namespace winrt
433433
434434 private:
435435
436+ static int32_t __stdcall fallback_SetThreadpoolTimerEx (winrt::impl::ptp_timer, void *, uint32_t , uint32_t ) noexcept
437+ {
438+ return 0 ; // pretend timer has already triggered and a callback is on its way
439+ }
440+
436441 void fire_immediately () noexcept
437442 {
438- if (WINRT_IMPL_SetThreadpoolTimer (m_timer.get (), nullptr , 0 , 0 ))
443+ static int32_t (__stdcall* handler)(winrt::impl::ptp_timer, void *, uint32_t , uint32_t ) noexcept ;
444+ impl::load_runtime_function (L" kernel32.dll" , " SetThreadpoolTimerEx" , handler, fallback_SetThreadpoolTimerEx);
445+
446+ if (handler (m_timer.get (), nullptr , 0 , 0 ))
439447 {
440448 int64_t now = 0 ;
441449 WINRT_IMPL_SetThreadpoolTimer (m_timer.get (), &now, 0 , 0 );
@@ -532,10 +540,17 @@ WINRT_EXPORT namespace winrt
532540 }
533541
534542 private:
543+ static int32_t __stdcall fallback_SetThreadpoolWaitEx (winrt::impl::ptp_wait, void *, void *, void *) noexcept
544+ {
545+ return 0 ; // pretend wait has already triggered and a callback is on its way
546+ }
535547
536548 void fire_immediately () noexcept
537549 {
538- if (WINRT_IMPL_SetThreadpoolWait (m_wait.get (), nullptr , nullptr ))
550+ static int32_t (__stdcall* handler)(winrt::impl::ptp_wait, void *, void *, void *) noexcept ;
551+ impl::load_runtime_function (L" kernel32.dll" , " SetThreadpoolWaitEx" , handler, fallback_SetThreadpoolWaitEx);
552+
553+ if (handler (m_wait.get (), nullptr , nullptr , nullptr ))
539554 {
540555 int64_t now = 0 ;
541556 WINRT_IMPL_SetThreadpoolWait (m_wait.get (), WINRT_IMPL_GetCurrentProcess (), &now);
0 commit comments