diff options
Diffstat (limited to 'Alc/backends/sndio.c')
-rw-r--r-- | Alc/backends/sndio.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Alc/backends/sndio.c b/Alc/backends/sndio.c index 9e43f08a..cdc052c8 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; @@ -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"); |