[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-dbus
Subject:    Re: [python-dbus/PyQt] Message loops in separate threads
From:       Simon McVittie <simon.mcvittie () collabora ! co ! uk>
Date:       2007-12-17 9:53:53
Message-ID: 20071217095353.GB3273 () carbon ! pseudorandom ! co ! uk
[Download RAW message or body]

On Sun, 16 Dec 2007 at 19:30:19 -0800, dwelch91 wrote:
> So, as a follow up to the PyQt/python-dbus issue connecting to both the
> session and system buses, should it be possible to place each messsge loop
> (Glib and PyQt) in a separate thread? Here's my naive attempt at this (that
> doesn't work). I guess I don't understand enough about the message loops to
> know whether this is completely misguided or not...

I believe that approach is misguided. Qt's QApplication wants to be run
in the main thread, while pygobject doesn't export enough C API for me
to run a main loop in a non-main thread (it always uses the default
GMainContext).

(Also, the semantics of DBusConnection are that if you ever make a blocking
method call on one thread, it takes a lock, and all API calls made by the
other thread on the same connection will block waiting for the lock until the
blocking method returns; this means you can't usefully make blocking calls on
the same connection from two threads.)

    Simon
_______________________________________________
dbus mailing list
dbus@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dbus
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic