ref: 3007081a8780cef13dcee5c5fb6640cb316de827
parent: 7954e67bb85b6b13ab8ff4036fff29bfc3547901
author: James Zern <jzern@google.com>
date: Fri Jul 1 10:38:14 EDT 2016
vpx_thread: use CreateThread for windows phone BUG=b/29583578 original webp change: commit d2afe974f9d751de144ef09d31255aea13b442c0 Author: James Zern <jzern@google.com> Date: Mon Nov 23 20:41:26 2015 -0800 thread: use CreateThread for windows phone _beginthreadex is unavailable for winrt/uwp Change-Id: Ie7412a568278ac67f0047f1764e2521193d74d4d 100644 blob 93f7622797f05f6acc1126e8296c481d276e4047 src/utils/thread.c 100644 blob 840831185502d42a3246e4b7ff870121c8064791 src/utils/thread.h Change-Id: Iade8fff6367b45534986c77ebe61abeb45bce0f8
--- a/vpx_util/vpx_thread.h
+++ b/vpx_util/vpx_thread.h
@@ -45,6 +45,15 @@
} pthread_cond_t;
#endif // _WIN32_WINNT >= 0x600
+#ifndef WINAPI_FAMILY_PARTITION
+#define WINAPI_PARTITION_DESKTOP 1
+#define WINAPI_FAMILY_PARTITION(x) x
+#endif
+
+#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+#define USE_CREATE_THREAD
+#endif
+
//------------------------------------------------------------------------------
// simplistic pthread emulation layer
@@ -61,6 +70,14 @@
unsigned int (__stdcall *start)(void*),
void* arg) {
(void)attr;
+#ifdef USE_CREATE_THREAD
+ *thread = CreateThread(NULL, /* lpThreadAttributes */
+ 0, /* dwStackSize */
+ start,
+ arg,
+ 0, /* dwStackSize */
+ NULL); /* lpThreadId */
+#else
*thread = (pthread_t)_beginthreadex(NULL, /* void *security */
0, /* unsigned stack_size */
start,
@@ -67,6 +84,7 @@
arg,
0, /* unsigned initflag */
NULL); /* unsigned *thrdaddr */
+#endif
if (*thread == NULL) return 1;
SetThreadPriority(*thread, THREAD_PRIORITY_ABOVE_NORMAL);
return 0;