[pulseaudio-discuss] Why doesn't mixer control (values) have some kind of locking mechanism? (mutex?)

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Thu Aug 6 15:30:36 UTC 2020




> ALSA control core allows applications to lock/unlock a control element
> so that any write opreation to the control element fails for processes
> except for owner process.
> 
> When a process requests `SNDRV_CTL_IOCTL_ELEM_LOCK`[1] against a
> control element. After operating the request, the control element is
> under 'owned by the process' state. In this state, any request of
> `SNDRV_CTL_IOCTL_ELEM_WRITE` from the other processes fails with
> `-EPERM`[2]. The write operation from the owner process is successful
> only. When the owner process is going to finish, the state is
> released[3].
> 
> ALSA userspace library, a.k.a alsa-lib, has a pair of
> `snd_ctl_elem_lock()` and `snd_ctl_elem_unlock()` as its exported
> API[4].

Thank you Sakamoto-san for this explanation, I wasn't even aware this 
existed.

What I was trying to describe in my earlier answer is a different need 
to have an atomic update of *multiple* controls.

If e.g. a DSP or hardware engine exposes two separate filters for left 
and right channels, and the coefficients for those filters are modified 
with separate controls, it would be really nice to have the capability 
of writing these controls separately, but have a 'commit' mechanism so 
that these updated coefficients are used at the same time by the left 
and right filters.


More information about the pulseaudio-discuss mailing list