]> git.alsa-project.org Git - alsa-lib.git/commit
pcm: direct: fix race on clearing timer events
authorAndreas Pape <apape@de.adit-jv.com>
Fri, 17 Feb 2017 07:15:56 +0000 (12:45 +0530)
committerTakashi Iwai <tiwai@suse.de>
Fri, 17 Feb 2017 17:38:08 +0000 (18:38 +0100)
commit9219034301a3bf3d8de57ac5672bbc1c53f18049
tree835f12203f501504d12356cf8e9207bdb3a58c6a
parentdf7694d80cdd7d273b34ead6841b9f32f5991966
pcm: direct: fix race on clearing timer events

snd_timer handling is racy: plugins clear timer queue if avail_min
is not reached to force a sleep on timer. The race can happen if
the expected event arrives in between the avail check and the
clearing of pending events. If this race happens, the user will
unnecessarily wait for one more timer event. On low latency/realtime
streams this can lead to xruns and must be avoided.

As a fix we recheck avail after having cleared poll events.

Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Mounesh Sutar <sutar.mounesh@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/pcm/pcm_direct.c
src/pcm/pcm_direct.h