mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Make thread local storage optional
This commit is contained in:
parent
dd36cff174
commit
330a8d7594
@ -575,6 +575,10 @@ ifeq ($(HAVE_THREADS), 1)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(HAVE_THREAD_STORAGE), 1)
|
||||||
|
DEFINES += -DHAVE_THREAD_STORAGE
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(HAVE_WAYLAND), 1)
|
ifeq ($(HAVE_WAYLAND), 1)
|
||||||
OBJ += gfx/drivers_context/wayland_ctx.o
|
OBJ += gfx/drivers_context/wayland_ctx.o
|
||||||
DEFINES += $(WAYLAND_CFLAGS)
|
DEFINES += $(WAYLAND_CFLAGS)
|
||||||
@ -1064,7 +1068,7 @@ OBJ += $(ZLIB_OBJS)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Video4Linux 2
|
# Video4Linux 2
|
||||||
|
|
||||||
ifeq ($(HAVE_V4L2),1)
|
ifeq ($(HAVE_V4L2),1)
|
||||||
OBJ += camera/drivers/video4linux2.o
|
OBJ += camera/drivers/video4linux2.o
|
||||||
|
@ -35,7 +35,10 @@ RETRO_BEGIN_DECLS
|
|||||||
typedef struct sthread sthread_t;
|
typedef struct sthread sthread_t;
|
||||||
typedef struct slock slock_t;
|
typedef struct slock slock_t;
|
||||||
typedef struct scond scond_t;
|
typedef struct scond scond_t;
|
||||||
|
|
||||||
|
#ifdef HAVE_THREAD_STORAGE
|
||||||
typedef unsigned sthread_tls_t;
|
typedef unsigned sthread_tls_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sthread_create:
|
* sthread_create:
|
||||||
@ -179,6 +182,7 @@ int scond_broadcast(scond_t *cond);
|
|||||||
**/
|
**/
|
||||||
void scond_signal(scond_t *cond);
|
void scond_signal(scond_t *cond);
|
||||||
|
|
||||||
|
#ifdef HAVE_THREAD_STORAGE
|
||||||
/**
|
/**
|
||||||
* @brief Creates a thread local storage key
|
* @brief Creates a thread local storage key
|
||||||
*
|
*
|
||||||
@ -218,6 +222,7 @@ void *sthread_tls_get(sthread_tls_t *tls);
|
|||||||
* @return whether the operation suceeded or not
|
* @return whether the operation suceeded or not
|
||||||
*/
|
*/
|
||||||
bool sthread_tls_set(sthread_tls_t *tls, const void *data);
|
bool sthread_tls_set(sthread_tls_t *tls, const void *data);
|
||||||
|
#endif
|
||||||
|
|
||||||
RETRO_END_DECLS
|
RETRO_END_DECLS
|
||||||
|
|
||||||
|
@ -475,6 +475,7 @@ bool scond_wait_timeout(scond_t *cond, slock_t *lock, int64_t timeout_us)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_THREAD_STORAGE
|
||||||
bool sthread_tls_create(sthread_tls_t *tls)
|
bool sthread_tls_create(sthread_tls_t *tls)
|
||||||
{
|
{
|
||||||
#ifdef USE_WIN32_THREADS
|
#ifdef USE_WIN32_THREADS
|
||||||
@ -510,3 +511,4 @@ bool sthread_tls_set(sthread_tls_t *tls, const void *data)
|
|||||||
return pthread_setspecific(*tls, data) == 0;
|
return pthread_setspecific(*tls, data) == 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -150,9 +150,17 @@ fi
|
|||||||
|
|
||||||
if [ "$OS" = 'Win32' ]; then
|
if [ "$OS" = 'Win32' ]; then
|
||||||
HAVE_THREADS=yes
|
HAVE_THREADS=yes
|
||||||
|
HAVE_THREAD_STORAGE=yes
|
||||||
HAVE_DYLIB=yes
|
HAVE_DYLIB=yes
|
||||||
else
|
else
|
||||||
check_lib THREADS "$PTHREADLIB" pthread_create
|
check_lib THREADS "$PTHREADLIB" pthread_create
|
||||||
|
|
||||||
|
if [ "$HAVE_THREADS" = 'yes' ]; then
|
||||||
|
check_lib THREAD_STORAGE "$PTHREADLIB" pthread_key_create
|
||||||
|
else
|
||||||
|
HAVE_THREAD_STORAGE=no
|
||||||
|
fi
|
||||||
|
|
||||||
check_lib DYLIB "$DYLIB" dlopen
|
check_lib DYLIB "$DYLIB" dlopen
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
HAVE_LIBRETRODB=yes # Libretrodb support
|
HAVE_LIBRETRODB=yes # Libretrodb support
|
||||||
HAVE_RGUI=yes # RGUI menu
|
HAVE_RGUI=yes # RGUI menu
|
||||||
HAVE_MATERIALUI=auto # MaterialUI menu
|
HAVE_MATERIALUI=auto # MaterialUI menu
|
||||||
HAVE_XMB=auto # XMB menu
|
HAVE_XMB=auto # XMB menu
|
||||||
HAVE_ZARCH=no # Zarch menu
|
HAVE_ZARCH=no # Zarch menu
|
||||||
HAVE_NUKLEAR=no # Nuklear menu
|
HAVE_NUKLEAR=no # Nuklear menu
|
||||||
@ -20,6 +20,7 @@ HAVE_MAN_DIR= # Manpage install directory
|
|||||||
HAVE_OPENGLES_LIBS= # Link flags for custom GLES library
|
HAVE_OPENGLES_LIBS= # Link flags for custom GLES library
|
||||||
HAVE_OPENGLES_CFLAGS= # C-flags for custom GLES library
|
HAVE_OPENGLES_CFLAGS= # C-flags for custom GLES library
|
||||||
HAVE_THREADS=auto # Threading support
|
HAVE_THREADS=auto # Threading support
|
||||||
|
HAVE_THREAD_STORAGE=auto # Thread Local Storage support
|
||||||
HAVE_FFMPEG=auto # FFmpeg recording support
|
HAVE_FFMPEG=auto # FFmpeg recording support
|
||||||
C89_FFMPEG=no
|
C89_FFMPEG=no
|
||||||
HAVE_SSA=auto # SSA/ASS for FFmpeg subtitle support
|
HAVE_SSA=auto # SSA/ASS for FFmpeg subtitle support
|
||||||
|
@ -1108,7 +1108,7 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
|
|||||||
static bool rarch_ips_pref = false;
|
static bool rarch_ips_pref = false;
|
||||||
static bool rarch_patch_blocked = false;
|
static bool rarch_patch_blocked = false;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREAD_STORAGE
|
||||||
static sthread_tls_t rarch_tls;
|
static sthread_tls_t rarch_tls;
|
||||||
const void *MAGIC_POINTER = (void*)0xB16B00B5;
|
const void *MAGIC_POINTER = (void*)0xB16B00B5;
|
||||||
#endif
|
#endif
|
||||||
@ -1223,13 +1223,13 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
|
|||||||
|
|
||||||
rarch_ctl(RARCH_CTL_UNSET_INITED, NULL);
|
rarch_ctl(RARCH_CTL_UNSET_INITED, NULL);
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREAD_STORAGE
|
||||||
sthread_tls_delete(&rarch_tls);
|
sthread_tls_delete(&rarch_tls);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case RARCH_CTL_INIT:
|
case RARCH_CTL_INIT:
|
||||||
rarch_ctl(RARCH_CTL_DEINIT, NULL);
|
rarch_ctl(RARCH_CTL_DEINIT, NULL);
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREAD_STORAGE
|
||||||
sthread_tls_create(&rarch_tls);
|
sthread_tls_create(&rarch_tls);
|
||||||
sthread_tls_set(&rarch_tls, MAGIC_POINTER);
|
sthread_tls_set(&rarch_tls, MAGIC_POINTER);
|
||||||
#endif
|
#endif
|
||||||
@ -1319,7 +1319,7 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case RARCH_CTL_IS_MAIN_THREAD:
|
case RARCH_CTL_IS_MAIN_THREAD:
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREAD_STORAGE
|
||||||
return sthread_tls_get(&rarch_tls) == MAGIC_POINTER;
|
return sthread_tls_get(&rarch_tls) == MAGIC_POINTER;
|
||||||
#else
|
#else
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user