History

Avoid using C++/CX code for threads for Windows Phone/Windows Store/UWP

The CreateThread function was only unavailable in Windows (Phone) 8.0, but became available again in Windows Phone 8.1 and for Store apps in Windows 8.1. This avoids building source files with the /ZW flag for C++/CX mode, simplifying integration with other projects and build systems.

Martin Storsjö committed 8 years ago

Commit 56a721d1 parent bb255193 files · +2 −26Browse files

Showing the changes to codec/common/src/WelsThreadLib.cpp (1 of 3 files). Show all

Unified · Split

codec/common/src/WelsThreadLib.cpp+0−15
@@ -74,10 +74,6 @@ · 73 unmodified lines
7474 #ifdef WINAPI_FAMILY
7575 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
7676 #define WP80
77−using namespace Platform;
78−using namespace Windows::Foundation;
79−using namespace Windows::System::Threading;
80−#define USE_THREADPOOL
8177
8278 #define InitializeCriticalSection(x) InitializeCriticalSectionEx(x, 0, 0)
8379 #define GetSystemInfo(x) GetNativeSystemInfo(x)
@@ -200,18 +196,7 @@ void WelsSleep (uint32_t dwMilliSecond) { · 116 unmodified lines
200196
201197 WELS_THREAD_ERROR_CODE WelsThreadCreate (WELS_THREAD_HANDLE* thread, LPWELS_THREAD_ROUTINE routine,
202198 void* arg, WELS_THREAD_ATTR attr) {
203−#ifdef USE_THREADPOOL
204− HANDLE h = CreateEvent (NULL, FALSE, FALSE, NULL);
205− HANDLE h2;
206− DuplicateHandle (GetCurrentProcess(), h, GetCurrentProcess(), &h2, 0, FALSE, DUPLICATE_SAME_ACCESS);
207− ThreadPool::RunAsync (ref new WorkItemHandler ([ = ] (IAsyncAction^) {
208− routine (arg);
209− SetEvent (h2);
210− CloseHandle (h2);
211− }, CallbackContext::Any), WorkItemPriority::Normal, WorkItemOptions::TimeSliced);
212−#else
213199 WELS_THREAD_HANDLE h = CreateThread (NULL, 0, routine, arg, 0, NULL);
214−#endif
215200
216201 if (h == NULL) {
217202 return WELS_THREAD_ERROR_GENERAL;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t