Skip to content

Fix thread safety issues

Jerome Forissier alsa-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2Make snd_device_name_hint() thread-safe by locking a mutexsrc/control/namehint.c+31 -00 replies
2/2snd_pcm_direct_parse_open_conf(): use thread-safe getgrnam_r()src/pcm/pcm_direct.c+11 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Fix thread safety issues

This is a set of two patches to fix thread safety issues I found when running a video application over ALSA. The application uses LibVLC to play several videos simultaneously. LibVLC calls snd_pcm_open() and snd_device_name_hint() from multiple threads, without locking--which is allowed according to
http://www.alsa-project.org/main/index.php/SMP_Design.

Without these patches, I would get random error messages like:

ALSA lib confmisc.c:768:(parse_card) cannot find card '$CARD'
ALSA lib conf.c:4184:(_snd_config_evaluate) function snd_func_card_driver returned error: No such device ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4184:(_snd_config_evaluate) function snd_func_concat returned error: No such device ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4184:(_snd_config_evaluate) function snd_func_refer returned error: No such device ALSA lib conf.c:4663:(snd_config_expand) Evaluate error: No such device

Jerome Forissier (2):
Make snd_device_name_hint() thread-safe by locking a mutex snd_pcm_direct_parse_open_conf(): use thread-safe getgrnam_r()

 src/control/namehint.c | 31 +++++++++++++++++++++++++++++++
 src/pcm/pcm_direct.c   | 15 +++++++++++----
 2 files changed, 42 insertions(+), 4 deletions(-)
Signature · 1 line
1.8.1.2