From 208143b6d68ddf69ad0ef378056f6d715afd973e Mon Sep 17 00:00:00 2001 From: "C. M. Barth" Date: Wed, 23 Dec 2020 15:30:54 -0800 Subject: [PATCH] Add flag to avoid consuming windows runtime in winrt c++ applications (#259) * add thread workaround to avoid consuming windows runtime library * add optional flag to avoid using windows runtime * remove any dependency on the windows runtime --- src/thread.cpp | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/src/thread.cpp b/src/thread.cpp index f534b51..a04d5fa 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -32,15 +32,11 @@ # endif // BX_PLATFORM_ #elif BX_PLATFORM_WINDOWS \ || BX_PLATFORM_WINRT \ - || BX_PLATFORM_XBOXONE + || BX_PLATFORM_XBOXONE \ + || BX_PLATFORM_WINRT # include # include # include -# if BX_PLATFORM_WINRT -using namespace Platform; -using namespace Windows::Foundation; -using namespace Windows::System::Threading; -# endif // BX_PLATFORM_WINRT #endif // BX_PLATFORM_ namespace bx @@ -146,7 +142,8 @@ namespace bx return false; } #elif BX_PLATFORM_WINDOWS \ - || BX_PLATFORM_XBOXONE + || BX_PLATFORM_XBOXONE \ + || BX_PLATFORM_WINRT ti->m_handle = ::CreateThread(NULL , m_stackSize , (LPTHREAD_START_ROUTINE)ti->threadFunc @@ -158,23 +155,6 @@ namespace bx { return false; } -#elif BX_PLATFORM_WINRT - ti->m_handle = CreateEventEx(nullptr, nullptr, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS); - - if (NULL == ti->m_handle) - { - return false; - } - - auto workItemHandler = ref new WorkItemHandler([=](IAsyncAction^) - { - m_exitCode = ti->threadFunc(this); - SetEvent(ti->m_handle); - } - , CallbackContext::Any - ); - - ThreadPool::RunAsync(workItemHandler, WorkItemPriority::Normal, WorkItemOptions::TimeSliced); #elif BX_PLATFORM_POSIX int result; BX_UNUSED(result);