On Thu, 07 Jul 2016 16:40:10 +0200, Takashi Iwai wrote:
Hi,
here is a v2 patchset for supporting multi thread safety to alsa-lib PCM API. Now it's out from RFC and should be reviewed as an official patchset.
Basically ALSA PCM functions are thread-unsafe, and applications are supposed to do the proper protection against racy accesses. The reality is, however, that application developers don't care such, as alsa-lib works in most cases. Of course, users still get occasionally mysterious crashes.
As a workaround, this patchset adds the pthread mutex protection to most of exported PCM functions. This is slightly an overkill, but the biggest merit is that it's easy to implement; I just wrapped the functions and replaced the internal ones with unlocked versions.
To be noted, there is an optimization for the direct hw PCM access. Performance-sensitive applications like JACK should work like before without any overhead.
Another bonus by this addition is that we can finally get rid of home brew (and deadly smelling) atomic macros from the tree, since it's now more widely protected.
I lightly tested on my local machines (dmix, PA, jack and plugins) and all seem working well, so far.
As there's been no objection, I pushed this patchset now. Let me know if this gives any regression.
thanks,
Takashi