diff options
author | James Zern <jzern@google.com> | 2016-07-01 14:38:14 -0700 |
---|---|---|
committer | James Zern <jzern@google.com> | 2016-07-01 19:36:58 -0700 |
commit | 3007081a8780cef13dcee5c5fb6640cb316de827 (patch) | |
tree | 3a0237e043d765186a797c02a473d2bfe95fb6cf /vpx_util | |
parent | 7954e67bb85b6b13ab8ff4036fff29bfc3547901 (diff) | |
download | libvpx-3007081a8780cef13dcee5c5fb6640cb316de827.tar libvpx-3007081a8780cef13dcee5c5fb6640cb316de827.tar.gz libvpx-3007081a8780cef13dcee5c5fb6640cb316de827.tar.bz2 libvpx-3007081a8780cef13dcee5c5fb6640cb316de827.zip |
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
Diffstat (limited to 'vpx_util')
-rw-r--r-- | vpx_util/vpx_thread.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/vpx_util/vpx_thread.h b/vpx_util/vpx_thread.h index 30f47a14d..f554bbca1 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; |