Discussion:
[pulseaudio-discuss] question: is the mainloop api vtable mutable?
j***@gmail.com
2018-06-16 19:01:58 UTC
Permalink
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...
Tanu Kaskinen
2018-06-25 15:57:15 UTC
Permalink
Post by j***@gmail.com
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.
--
Tanu

https://liberapay.com/tanuk
https://www.patreon.com/tanuk
j***@gmail.com
2018-06-28 16:41:41 UTC
Permalink
Post by Tanu Kaskinen
Post by j***@gmail.com
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.
Ok, right yes. I had to rush that email out and did not think that bit
through.

I've just sent in a load of patches relating to it in a separate email.
I meant to reply to this previously but an update broke my mail client
briefly :/

Thanks :)

Loading...