Is it possible to integrate asyncore
with dbus
through the same main loop
?
Usually, DBus integration is done through glib
main loop: is it possible to have either asyncore
integrate this main loop or have dbus use asyncore
's ?
The asyncore module provides a “reactive” socket implementation. Instead of creating socket objects and calling methods on them to do things, this module allows you to write code that is called when something can be done.
The asyncore. loop function starts the underlying channel services. These channel services can be instances of classes that inherit the asyncore.
asyncore
sucks. glib
already provides async stuff, so just use glib
's mainloop to do everything.
I wrote a trivial GSource
wrapper for one of my own projects called AsyncoreGSource
Just attach it to an appropriate MainContext
:
source = AsyncoreGSource([socket_map])
source.attach([main_context])
Naturally the defaults are asyncore.socket_map
and the default MainContext
respectively.
You can also try monkey-patching asyncore.socket_map
, which would have been my solution had I not poked through the GLib python bindings source code for GSource
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With