python bindings & gmainloop
Jakub Piotr Cłapa
jpc at pld-linux.org
Wed Sep 14 16:23:33 PDT 2005
John (J5) Palmieri wrote:
> On Wed, 2005-09-14 at 15:11 -0700, Sean Meiners wrote:
>> Is there any way, at all, to use the python bindings without the gmainloop?
>> The reason I as is that I'm writing a couple of apps in pykde/qt and find
>> that entering the gmainloop prevents the python interpreter from servicing
>> any other threads (both python threads and QThreads). I've worked around
>> this issue temporarily by creating a function that sleeps for a short time
>> and passing it to gobject.timeout_add. This seems to give enough time back
>> to the interpreter to service other threads, but it just doesn't feel like
>> the right way to go about it (time-slicing is the kernel's job). I would
>> much prefer to use a python thread (or the Qt event loop if necessary) to
>> service the dbus signal receivers. Is this currently possible?
>
> For sending you can just use blocking calls but for receiving you need
> to have a main loop that is integrated with D-Bus. gmainloop shouldn't
> block other threads though. Can you try making a loop without using
> dbus and see if that also causes the problem in which case it is a bug
> in PyGTK? If it doesn't then the Pyrex bindings could be holding onto
> the GIL for too long.
>
> Another point is I recently split out the GLib stuff so anyone is free
> to implement another main loop adapter. Look at the dbus.py and
> dbus_glib_bindings.pyx files to see how this is done. Patches are
> welcome.
Oh, cool. :)
So my previous "AFAIR" is much less true now. :-)
--
Regards,
Jakub Piotr Cłapa
More information about the dbus
mailing list