[pulseaudio-discuss] question: is the mainloop api vtable mutable?

Tanu Kaskinen tanuk at iki.fi
Mon Jun 25 15:57:15 UTC 2018

On Sat, 2018-06-16 at 20:01 +0100, jnqnfe at gmail.com wrote:
> Is it intended that the mainloop API vtable be mutable, allowing users
> to hijack it with their own (proxy) methods, or should it and the
> 'get_api' functions really be constified?
> I held off on constifying this thus far (in both patching PA itself and
> in my Rust bindings) because I really wasn't sure what the intention
> was...
> With my latest work tidying things up in v2.x of the binding (just
> released), and with needing to now look to whether `Futures` is
> something to implement (with which I need to understand how future
> execution would couple with the mainloop), I really need to know this
> now...

The vtable isn't meant to be mutable, but pa_mainloop_get_api() can't
be changed to return a const pointer, because that will break
applications that assign the result to a non-const variable. Only
function arguments can be constified, not function return values.



More information about the pulseaudio-discuss mailing list