[pulseaudio-discuss] Clean-up callbacks for pa_operation's
favonia at gmail.com
Sat May 12 04:59:05 PDT 2012
Recently my friends and I are developing a high-level interface for
PulseAudio in Haskell. Our goal is to make it callback-free but still
asynchronous. However we encountered a design issue that makes the
wrapper quite clumsy. Fortunately we believe this can be solved with
some help from libpulse.
The issue is that we need to clean up some resources when an operation
fails or is canceled. Currently one can only attach a callback to an
operation that will be called when it successes; unfortunately we need
more than that. A particular use case is that when a connection is
interrupted we need to clean up all the resources corresponding to
pending operations. In order to do so, we need to keep essentially a
copy of context->operations within our wrapper. Things would have be
more elegant if we could set up callbacks for failure and/or cancellation
We understand that this would probably lead to an API change so we
might have to keep the current clumsy design. Nonetheless we hope
this can be taken into consideration at least for the next API revision.
PS: Our code is at https://github.com/favonia/pulse but it's not
working yet, sorry.
More information about the pulseaudio-discuss