mirror of
https://github.com/webmproject/libwebp.git
synced 2025-01-30 00:22:55 +01:00
thread: use CreateThread for windows phone
_beginthreadex is unavailable for winrt/uwp Change-Id: Ie7412a568278ac67f0047f1764e2521193d74d4d
This commit is contained in:
parent
0fd0e12bfe
commit
d2afe974f9
@ -35,6 +35,15 @@ typedef struct {
|
|||||||
} pthread_cond_t;
|
} pthread_cond_t;
|
||||||
#endif // _WIN32_WINNT >= 0x600
|
#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
|
||||||
|
|
||||||
#else // !_WIN32
|
#else // !_WIN32
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
@ -66,12 +75,21 @@ struct WebPWorkerImpl {
|
|||||||
static int pthread_create(pthread_t* const thread, const void* attr,
|
static int pthread_create(pthread_t* const thread, const void* attr,
|
||||||
unsigned int (__stdcall *start)(void*), void* arg) {
|
unsigned int (__stdcall *start)(void*), void* arg) {
|
||||||
(void)attr;
|
(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 */
|
*thread = (pthread_t)_beginthreadex(NULL, /* void *security */
|
||||||
0, /* unsigned stack_size */
|
0, /* unsigned stack_size */
|
||||||
start,
|
start,
|
||||||
arg,
|
arg,
|
||||||
0, /* unsigned initflag */
|
0, /* unsigned initflag */
|
||||||
NULL); /* unsigned *thrdaddr */
|
NULL); /* unsigned *thrdaddr */
|
||||||
|
#endif
|
||||||
if (*thread == NULL) return 1;
|
if (*thread == NULL) return 1;
|
||||||
SetThreadPriority(*thread, THREAD_PRIORITY_ABOVE_NORMAL);
|
SetThreadPriority(*thread, THREAD_PRIORITY_ABOVE_NORMAL);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user