mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 04:20:27 +00:00
sthread_isself - make Win32 codepath use GetCurrentThreadId instead
This commit is contained in:
parent
18d27468ae
commit
b3d3cbd4e1
@ -76,6 +76,7 @@ struct sthread
|
|||||||
{
|
{
|
||||||
#ifdef USE_WIN32_THREADS
|
#ifdef USE_WIN32_THREADS
|
||||||
HANDLE thread;
|
HANDLE thread;
|
||||||
|
DWORD id;
|
||||||
#else
|
#else
|
||||||
pthread_t id;
|
pthread_t id;
|
||||||
#endif
|
#endif
|
||||||
@ -161,9 +162,7 @@ sthread_t *sthread_create(void (*thread_func)(void*), void *userdata)
|
|||||||
bool thread_created = false;
|
bool thread_created = false;
|
||||||
struct thread_data *data = NULL;
|
struct thread_data *data = NULL;
|
||||||
sthread_t *thread = (sthread_t*)calloc(1, sizeof(*thread));
|
sthread_t *thread = (sthread_t*)calloc(1, sizeof(*thread));
|
||||||
#if defined(_WIN32_WINNT) && _WIN32_WINNT <= 0x0410
|
|
||||||
DWORD thread_id = 0;
|
|
||||||
#endif
|
|
||||||
if (!thread)
|
if (!thread)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -175,11 +174,7 @@ sthread_t *sthread_create(void (*thread_func)(void*), void *userdata)
|
|||||||
data->userdata = userdata;
|
data->userdata = userdata;
|
||||||
|
|
||||||
#ifdef USE_WIN32_THREADS
|
#ifdef USE_WIN32_THREADS
|
||||||
#if defined(_WIN32_WINNT) && _WIN32_WINNT <= 0x0410
|
thread->thread = CreateThread(NULL, 0, thread_wrap, data, 0, &thread->id);
|
||||||
thread->thread = CreateThread(NULL, 0, thread_wrap, data, 0, &thread_id);
|
|
||||||
#else
|
|
||||||
thread->thread = CreateThread(NULL, 0, thread_wrap, data, 0, NULL);
|
|
||||||
#endif
|
|
||||||
thread_created = !!thread->thread;
|
thread_created = !!thread->thread;
|
||||||
#else
|
#else
|
||||||
#if defined(VITA)
|
#if defined(VITA)
|
||||||
@ -259,10 +254,11 @@ void sthread_join(sthread_t *thread)
|
|||||||
bool sthread_isself(sthread_t *thread)
|
bool sthread_isself(sthread_t *thread)
|
||||||
{
|
{
|
||||||
/* This thread can't possibly be a null thread */
|
/* This thread can't possibly be a null thread */
|
||||||
if (!thread) return false;
|
if (!thread)
|
||||||
|
return false;
|
||||||
|
|
||||||
#ifdef USE_WIN32_THREADS
|
#ifdef USE_WIN32_THREADS
|
||||||
return GetCurrentThread() == thread->thread;
|
return GetCurrentThreadId() == thread->id;
|
||||||
#else
|
#else
|
||||||
return pthread_equal(pthread_self(),thread->id);
|
return pthread_equal(pthread_self(),thread->id);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user