aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/sndio.c
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-06-10 05:30:02 +0200
committerSven Gothel <[email protected]>2014-06-10 05:30:02 +0200
commitf95bf4457fbc31112fa82dacbc1b7e094b9fd1cf (patch)
tree965ba5b8e6fc8e6bfe7a981c1dfb1179bb9adcde /Alc/backends/sndio.c
parent7297c3214a4c648aaee81a9877da15b88f798197 (diff)
parentc07fb7b45c1e345dbaa439882250de5b2213026f (diff)
Merge branch 'UPSTREAM' into UPSTREAM_MERGE
Diffstat (limited to 'Alc/backends/sndio.c')
-rw-r--r--Alc/backends/sndio.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/Alc/backends/sndio.c b/Alc/backends/sndio.c
index 80aebfd1..7152b2d6 100644
--- a/Alc/backends/sndio.c
+++ b/Alc/backends/sndio.c
@@ -47,11 +47,11 @@ typedef struct {
ALsizei data_size;
volatile int killNow;
- althread_t thread;
+ althrd_t thread;
} sndio_data;
-static ALuint sndio_proc(ALvoid *ptr)
+static int sndio_proc(void *ptr)
{
ALCdevice *device = ptr;
sndio_data *data = device->ExtraData;
@@ -59,7 +59,7 @@ static ALuint sndio_proc(ALvoid *ptr)
size_t wrote;
SetRTPriority();
- SetThreadName(MIXER_THREAD_NAME);
+ althrd_setname(althrd_current(), MIXER_THREAD_NAME);
frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType);
@@ -111,7 +111,7 @@ static ALCenum sndio_open_playback(ALCdevice *device, const ALCchar *deviceName)
return ALC_INVALID_VALUE;
}
- device->DeviceName = strdup(deviceName);
+ al_string_copy_cstr(&device->DeviceName, deviceName);
device->ExtraData = data;
return ALC_NO_ERROR;
@@ -224,7 +224,8 @@ static ALCboolean sndio_start_playback(ALCdevice *device)
data->data_size = device->UpdateSize * FrameSizeFromDevFmt(device->FmtChans, device->FmtType);
data->mix_data = calloc(1, data->data_size);
- if(!StartThread(&data->thread, sndio_proc, device))
+ data->killNow = 0;
+ if(althrd_create(&data->thread, sndio_proc, device) != althrd_success)
{
sio_stop(data->sndHandle);
free(data->mix_data);
@@ -238,15 +239,14 @@ static ALCboolean sndio_start_playback(ALCdevice *device)
static void sndio_stop_playback(ALCdevice *device)
{
sndio_data *data = device->ExtraData;
+ int res;
- if(!data->thread)
+ if(data->killNow)
return;
data->killNow = 1;
- StopThread(data->thread);
- data->thread = NULL;
+ althrd_join(data->thread, &res);
- data->killNow = 0;
if(!sio_stop(data->sndHandle))
ERR("Error stopping device\n");