#endif
+#ifdef USE_C11_THREADS
+#include <threads.h>
+
+static int c11_threads_cb_wrapper(void *cb)
+{
+ ((void (*)(void *))cb)(NULL);
+
+ return 0;
+}
+
+#define slock_new() ({ \
+ mtx_t *lock = malloc(sizeof(*lock)); \
+ if (lock) mtx_init(lock, mtx_plain); \
+ lock; \
+})
+
+#define scond_new() ({ \
+ cnd_t *cnd = malloc(sizeof(*cnd)); \
+ if (cnd) cnd_init(cnd); \
+ cnd; \
+})
+
+#define pcsxr_sthread_create(cb, unused) ({ \
+ thrd_t *thd = malloc(sizeof(*thd)); \
+ if (thd) \
+ thrd_create(thd, c11_threads_cb_wrapper, cb); \
+ thd; \
+})
+
+#define sthread_join(thrd) ({ \
+ thrd_join(*thrd, NULL); \
+ free(thrd); \
+})
+
+#define slock_free(lock) free(lock)
+#define slock_lock(lock) mtx_lock(lock)
+#define slock_unlock(lock) mtx_unlock(lock)
+#define scond_free(cond) free(cond)
+#define scond_wait(cond, lock) cnd_wait(cond, lock)
+#define scond_signal(cond) cnd_signal(cond)
+#define slock_t mtx_t
+#define scond_t cnd_t
+#define sthread_t thrd_t
+#else
#include "../frontend/libretro-rthreads.h"
+#endif
+
#include "retro_timers.h"
struct cached_buf {