optionnal signal registration during proxy lifetime #289
Replies: 1 comment 5 replies
-
Hi @antoine-girard-vallee, thanks for your patience with my reply :) and for sharing your proposal. It's true that underlying sd-bus library enables us to register/unregister signal handlers at any time during run time (which is not so simple for e.g. method call handlers on server side; it may be their intention). So we could really physically register signal handlers right away upon calling the registration function. We don't truly need The former we could solve by removing The latter is more important, because when generated proxy class is registering virtual functions as signal handlers in its constructor, the functions are pure at that moment. They are implemented in the derived class, which then does the What do you think of this? Would this meet your needs? I can prepare a PR for you. |
Beta Was this translation helpful? Give feedback.
-
It would be really useful in our usecases to be able to register/unregister signals freely during the lifetime of a proxy.
The uponSignal() helper methods seem to be intended for use in bulk right during init before calling finishRegistration() (at least by looking at generated stubs).
I propose allowing direct registration using connection_->registerSignalHandler() in Proxy::registerSignalHandler if the initial registration is complete. Paired with muteSignal(), it allows handling available signals only when needed.
I have a simple working patch locally tested on top of 1.2.0 that I could send up for review.
If this feature sounds helpful, I would be interested in discussing something that would integrate neatly in the stub generation, like an annotation for signals. With my patch, signals have to be handled separately as the stub generator registers all signals automatically.
Thank you for your time, and sorry if I missed something obvious in sdbus-cpp.
Antoine Girard-Vallée
Beta Was this translation helpful? Give feedback.
All reactions