mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-24 02:15:12 +00:00
Add more HAVE_THREADS ifdefs
This commit is contained in:
parent
377f09f12a
commit
5845a9944d
@ -291,8 +291,11 @@ ifeq ($(HAVE_OSS_BSD), 1)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_ALSA), 1)
|
||||
OBJ += audio/drivers/alsa.o \
|
||||
audio/drivers/alsathread.o
|
||||
OBJ += audio/drivers/alsa.o
|
||||
|
||||
ifeq ($(HAVE_THREADS), 1)
|
||||
OBJ += audio/drivers/alsathread.o
|
||||
endif
|
||||
LIBS += $(ALSA_LIBS)
|
||||
DEFINES += $(ALSA_CFLAGS)
|
||||
endif
|
||||
@ -575,11 +578,13 @@ ifeq ($(HAVE_UDEV), 1)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LIBUSB), 1)
|
||||
ifeq ($(HAVE_THREADS), 1)
|
||||
DEFINES += -DHAVE_LIBUSB
|
||||
OBJ += input/drivers_hid/libusb_hid.o
|
||||
LIBS += -lusb-1.0
|
||||
HAVE_HID = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_IOHIDMANAGER), 1)
|
||||
DEFINES += -DHAVE_IOHIDMANAGER
|
||||
|
@ -93,7 +93,7 @@ typedef struct audio_driver_input_data
|
||||
static const audio_driver_t *audio_drivers[] = {
|
||||
#ifdef HAVE_ALSA
|
||||
&audio_alsa,
|
||||
#ifndef __QNX__
|
||||
#if !defined(__QNX__) && defined(HAVE_THREADS)
|
||||
&audio_alsathread,
|
||||
#endif
|
||||
#endif
|
||||
|
@ -41,8 +41,10 @@ typedef struct jack
|
||||
bool nonblock;
|
||||
bool is_paused;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
scond_t *cond;
|
||||
slock_t *cond_lock;
|
||||
#endif
|
||||
size_t buffer_size;
|
||||
} jack_t;
|
||||
|
||||
@ -54,7 +56,9 @@ static int process_cb(jack_nframes_t nframes, void *data)
|
||||
|
||||
if (nframes <= 0)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
scond_signal(jd->cond);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -74,7 +78,9 @@ static int process_cb(jack_nframes_t nframes, void *data)
|
||||
for (f = min_avail; f < nframes; f++)
|
||||
out[f] = 0.0f;
|
||||
}
|
||||
#ifdef HAVE_THREADS
|
||||
scond_signal(jd->cond);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -86,7 +92,9 @@ static void shutdown_cb(void *data)
|
||||
return;
|
||||
|
||||
jd->shutdown = true;
|
||||
#ifdef HAVE_THREADS
|
||||
scond_signal(jd->cond);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int parse_ports(char **dest_ports, const char **jports)
|
||||
@ -149,8 +157,10 @@ static void *ja_init(const char *device, unsigned rate, unsigned latency)
|
||||
if (!jd)
|
||||
return NULL;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
jd->cond = scond_new();
|
||||
jd->cond_lock = slock_new();
|
||||
#endif
|
||||
|
||||
jd->client = jack_client_open("RetroArch", JackNullOption, NULL);
|
||||
if (jd->client == NULL)
|
||||
@ -258,12 +268,14 @@ static size_t write_buffer(jack_t *jd, const float *buf, size_t size)
|
||||
}
|
||||
written += write_frames;
|
||||
}
|
||||
#ifdef HAVE_THREADS
|
||||
else
|
||||
{
|
||||
slock_lock(jd->cond_lock);
|
||||
scond_wait(jd->cond, jd->cond_lock);
|
||||
slock_unlock(jd->cond_lock);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (jd->nonblock)
|
||||
break;
|
||||
@ -327,10 +339,12 @@ static void ja_free(void *data)
|
||||
if (jd->buffer[i] != NULL)
|
||||
jack_ringbuffer_free(jd->buffer[i]);
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
if (jd->cond_lock)
|
||||
slock_free(jd->cond_lock);
|
||||
if (jd->cond)
|
||||
scond_free(jd->cond);
|
||||
#endif
|
||||
free(jd);
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,10 @@ typedef struct sdl_audio
|
||||
bool nonblock;
|
||||
bool is_paused;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
slock_t *lock;
|
||||
scond_t *cond;
|
||||
#endif
|
||||
fifo_buffer_t *buffer;
|
||||
} sdl_audio_t;
|
||||
|
||||
@ -47,7 +49,9 @@ static void sdl_audio_cb(void *data, Uint8 *stream, int len)
|
||||
size_t write_size = len > (int)avail ? avail : len;
|
||||
|
||||
fifo_read(sdl->buffer, stream, write_size);
|
||||
#ifdef HAVE_THREADS
|
||||
scond_signal(sdl->cond);
|
||||
#endif
|
||||
|
||||
/* If underrun, fill rest with silence. */
|
||||
memset(stream + write_size, 0, len - write_size);
|
||||
@ -109,8 +113,10 @@ static void *sdl_audio_init(const char *device,
|
||||
|
||||
settings->audio.out_rate = out.freq;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
sdl->lock = slock_new();
|
||||
sdl->cond = scond_new();
|
||||
#endif
|
||||
|
||||
RARCH_LOG("SDL audio: Requested %u ms latency, got %d ms\n",
|
||||
latency, (int)(out.samples * 4 * 1000 / settings->audio.out_rate));
|
||||
@ -160,9 +166,11 @@ static ssize_t sdl_audio_write(void *data, const void *buf, size_t size)
|
||||
if (avail == 0)
|
||||
{
|
||||
SDL_UnlockAudio();
|
||||
#ifdef HAVE_THREADS
|
||||
slock_lock(sdl->lock);
|
||||
scond_wait(sdl->cond, sdl->lock);
|
||||
slock_unlock(sdl->lock);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -220,8 +228,10 @@ static void sdl_audio_free(void *data)
|
||||
if (sdl)
|
||||
{
|
||||
fifo_free(sdl->buffer);
|
||||
#ifdef HAVE_THREADS
|
||||
slock_free(sdl->lock);
|
||||
scond_free(sdl->cond);
|
||||
#endif
|
||||
}
|
||||
free(sdl);
|
||||
}
|
||||
|
@ -706,7 +706,7 @@ static void gfx_ctx_wl_destroy(void *data)
|
||||
switch (wl_api)
|
||||
{
|
||||
case GFX_CTX_VULKAN_API:
|
||||
#ifdef HAVE_VULKAN
|
||||
#if defined(HAVE_VULKAN) && defined(HAVE_THREADS)
|
||||
if (wl->vk.context.queue_lock)
|
||||
slock_free(wl->vk.context.queue_lock);
|
||||
#endif
|
||||
|
@ -167,7 +167,7 @@ static void gfx_ctx_x_destroy(void *data)
|
||||
switch (x_api)
|
||||
{
|
||||
case GFX_CTX_VULKAN_API:
|
||||
#ifdef HAVE_VULKAN
|
||||
#if defined(HAVE_VULKAN) && defined(HAVE_THREADS)
|
||||
if (x->vk.context.queue_lock)
|
||||
slock_free(x->vk.context.queue_lock);
|
||||
#endif
|
||||
|
@ -430,7 +430,7 @@ INPUT (HID)
|
||||
|
||||
#include "../input/drivers_hid/null_hid.c"
|
||||
|
||||
#if defined(HAVE_LIBUSB)
|
||||
#if defined(HAVE_LIBUSB) && defined(HAVE_THREADS)
|
||||
#include "../input/drivers_hid/libusb_hid.c"
|
||||
#endif
|
||||
|
||||
|
@ -29,7 +29,7 @@ static hid_driver_t *hid_drivers[] = {
|
||||
#if defined(__APPLE__) && defined(HAVE_IOHIDMANAGER)
|
||||
&iohidmanager_hid,
|
||||
#endif
|
||||
#ifdef HAVE_LIBUSB
|
||||
#if defined(HAVE_LIBUSB) && defined(HAVE_THREADS)
|
||||
&libusb_hid,
|
||||
#endif
|
||||
#ifdef HW_RVL
|
||||
|
Loading…
x
Reference in New Issue
Block a user