
We need to check it, of course. But the behavior of the prepare function is certainly different from others, so it's more likely a bug.
I could provide a fix for the IO plug API for prepare and draining.
This should be notified to ioplug via snd_pcm_ioplug_set_state().
Without an additional variable snd_pcm_ioplug_set_state() has to be called from the JACK thread. But snd_pcm_ioplug_set_state() is not thread safe.
That'd be great if everything is ready, but this can't be a reason to add a shadow state and modify the code as in the patch for now.
At the end I would like to use functions similar to READ_ONCE() and WRITE_ONCE() to access the state (known from the Linux kernel [1]). But I think this should not be part of the ALSA library because it is for most IO plugins not required. Therefore I need to have an internal copy of the state which will only be accessed with READ_ONCE() and WRITE_ONCE().
You are right, it is not yet required but at the end I have to implement it.
Do you think we should implement such a synchronization into the ALSA lib?
[1] https://www.kernel.org/doc/Documentation/memory-barriers.txt
Best regards
Timo Wischer
Advanced Driver Information Technology GmbH Engineering Software Base (ADITG/ESB) Robert-Bosch-Str. 200 31139 Hildesheim Germany
Tel. +49 5121 49 6938 Fax +49 5121 49 6999 twischer@de.adit-jv.com
ADIT is a joint venture company of Robert Bosch GmbH/Robert Bosch Car Multimedia GmbH and DENSO Corporation Sitz: Hildesheim, Registergericht: Amtsgericht Hildesheim HRB 3438 Geschäftsführung: Wilhelm Grabow, Ken Yaguchi