From 5a8ad6766034548fac39ba7426891e128ab96591 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 26 May 2009 14:54:59 -0700 Subject: Lock the context before getting the mmap region to update --- Alc/alsa.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Alc/alsa.c') diff --git a/Alc/alsa.c b/Alc/alsa.c index 9eaf3377..f8e04afa 100644 --- a/Alc/alsa.c +++ b/Alc/alsa.c @@ -206,28 +206,30 @@ static ALuint ALSAProc(ALvoid *ptr) { frames = avail; + SuspendContext(NULL); err = psnd_pcm_mmap_begin(data->pcmHandle, &areas, &offset, &frames); if (err < 0) { err = xrun_recovery(data->pcmHandle, err); if (err < 0) AL_PRINT("mmap begin error: %s\n", psnd_strerror(err)); + ProcessContext(NULL); break; } WritePtr = (char*)areas->addr + (offset * areas->step / 8); WriteCnt = psnd_pcm_frames_to_bytes(data->pcmHandle, frames); - SuspendContext(NULL); aluMixData(pDevice->Context, WritePtr, WriteCnt, pDevice->Format); - ProcessContext(NULL); commitres = psnd_pcm_mmap_commit(data->pcmHandle, offset, frames); if (commitres < 0 || (commitres-frames) != 0) { AL_PRINT("mmap commit error: %s\n", psnd_strerror(commitres >= 0 ? -EPIPE : commitres)); + ProcessContext(NULL); break; } + ProcessContext(NULL); avail -= frames; } -- cgit v1.2.3