aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/alsa.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-05-26 14:54:59 -0700
committerChris Robinson <[email protected]>2009-05-26 14:54:59 -0700
commit5a8ad6766034548fac39ba7426891e128ab96591 (patch)
tree9fbc18d394de88f5b195eeebe0dc218aa1bea8c1 /Alc/alsa.c
parentf1e442408bb607e3ca337fc18cf1e52bf38680f0 (diff)
Lock the context before getting the mmap region to update
Diffstat (limited to 'Alc/alsa.c')
-rw-r--r--Alc/alsa.c6
1 files changed, 4 insertions, 2 deletions
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;
}