aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/pulseaudio.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-04-16 05:19:34 -0700
committerChris Robinson <[email protected]>2014-04-16 05:19:34 -0700
commit18ab9cbbdd4b8db8e5cd9ea6155efafdb79fcad0 (patch)
tree236179c2cc0c0933946416a04a224e81a3eedc1f /Alc/backends/pulseaudio.c
parent29cb5058c0b05cca8ebeb40d84aba8a8d2e11075 (diff)
Implement a C11-like thread wrapper and use it in mmdevapi and pulseaudio
Diffstat (limited to 'Alc/backends/pulseaudio.c')
-rw-r--r--Alc/backends/pulseaudio.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c
index bb371453..6b7b00a3 100644
--- a/Alc/backends/pulseaudio.c
+++ b/Alc/backends/pulseaudio.c
@@ -479,7 +479,7 @@ typedef struct ALCpulsePlayback {
pa_context *context;
volatile ALboolean killNow;
- althread_t thread;
+ althrd_t thread;
} ALCpulsePlayback;
DECLARE_ALCBACKEND_VTABLE(ALCpulsePlayback);
@@ -496,7 +496,7 @@ static pa_stream *ALCpulsePlayback_connectStream(const char *device_name, pa_thr
pa_context *context, pa_stream_flags_t flags,
pa_buffer_attr *attr, pa_sample_spec *spec,
pa_channel_map *chanmap);
-static ALuint ALCpulsePlayback_mixerProc(ALvoid *ptr);
+static int ALCpulsePlayback_mixerProc(void *ptr);
static void ALCpulsePlayback_Construct(ALCpulsePlayback *self, ALCdevice *device);
static DECLARE_FORWARD(ALCpulsePlayback, ALCbackend, void, Destruct)
@@ -751,7 +751,7 @@ static pa_stream *ALCpulsePlayback_connectStream(const char *device_name,
}
-static ALuint ALCpulsePlayback_mixerProc(ALvoid *ptr)
+static int ALCpulsePlayback_mixerProc(void *ptr)
{
ALCpulsePlayback *self = ptr;
ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice;
@@ -1051,7 +1051,8 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self)
static ALCboolean ALCpulsePlayback_start(ALCpulsePlayback *self)
{
- if(!StartThread(&self->thread, ALCpulsePlayback_mixerProc, self))
+ self->killNow = AL_FALSE;
+ if(althrd_create(&self->thread, ALCpulsePlayback_mixerProc, self) != althrd_success)
return ALC_FALSE;
return ALC_TRUE;
}
@@ -1059,17 +1060,13 @@ static ALCboolean ALCpulsePlayback_start(ALCpulsePlayback *self)
static void ALCpulsePlayback_stop(ALCpulsePlayback *self)
{
pa_operation *o;
+ int res;
if(!self->stream)
return;
self->killNow = AL_TRUE;
- if(self->thread)
- {
- StopThread(self->thread);
- self->thread = NULL;
- }
- self->killNow = AL_FALSE;
+ althrd_join(self->thread, &res);
pa_threaded_mainloop_lock(self->loop);