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.
Showing the changes to codec/common/src/WelsThreadLib.cpp (1 of 3 files). Show all
Unified · Split
| @@ -74,10 +74,6 @@ · 73 unmodified lines | ||
| 74 | 74 | #ifdef WINAPI_FAMILY |
| 75 | 75 | #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) |
| 76 | 76 | #define WP80 |
| 77 | −using namespace Platform; | |
| 78 | −using namespace Windows::Foundation; | |
| 79 | −using namespace Windows::System::Threading; | |
| 80 | −#define USE_THREADPOOL | |
| 81 | 77 | |
| 82 | 78 | #define InitializeCriticalSection(x) InitializeCriticalSectionEx(x, 0, 0) |
| 83 | 79 | #define GetSystemInfo(x) GetNativeSystemInfo(x) |
| @@ -200,18 +196,7 @@ void WelsSleep (uint32_t dwMilliSecond) { · 116 unmodified lines | ||
| 200 | 196 | |
| 201 | 197 | WELS_THREAD_ERROR_CODE WelsThreadCreate (WELS_THREAD_HANDLE* thread, LPWELS_THREAD_ROUTINE routine, |
| 202 | 198 | 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 | |
| 213 | 199 | WELS_THREAD_HANDLE h = CreateThread (NULL, 0, routine, arg, 0, NULL); |
| 214 | −#endif | |
| 215 | 200 | |
| 216 | 201 | if (h == NULL) { |
| 217 | 202 | return WELS_THREAD_ERROR_GENERAL; |