views:

124

answers:

2

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 ?

+4  A: 

asyncore sucks. glib already provides async stuff, so just use glib's mainloop to do everything.

nosklo
A: 

Although you got what is probably a perfectly reasonable answer, there is another approach - you don't need to use asyncore's loop per se. Just call asyncore.loop with a zero timeout and a count of 1, which stops it iterating (and thus makes the function name completely misleading) and polls the sockets just once. Call this as often as you need.

I don't know anything about glib's async support but if it requires threads you might still get better performance by using asyncore in this way since it will use select or poll and won't need to spawn additional threads.

Kylotan
thanks for your thoughts - I have settled on Twisted for this project.
jldupont