From: James Zern Date: Fri, 1 Jul 2016 21:38:14 +0000 (-0700) Subject: vpx_thread: use CreateThread for windows phone X-Git-Tag: v1.6.1~432^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3007081a8780cef13dcee5c5fb6640cb316de827;p=platform%2Fupstream%2Flibvpx.git vpx_thread: use CreateThread for windows phone BUG=b/29583578 original webp change: commit d2afe974f9d751de144ef09d31255aea13b442c0 Author: James Zern 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 --- diff --git a/vpx_util/vpx_thread.h b/vpx_util/vpx_thread.h index 30f47a1..f554bbc 100644 --- a/vpx_util/vpx_thread.h +++ b/vpx_util/vpx_thread.h @@ -45,6 +45,15 @@ typedef struct { } 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,12 +70,21 @@ static INLINE int pthread_create(pthread_t* const thread, const void* attr, 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, arg, 0, /* unsigned initflag */ NULL); /* unsigned *thrdaddr */ +#endif if (*thread == NULL) return 1; SetThreadPriority(*thread, THREAD_PRIORITY_ABOVE_NORMAL); return 0;