[packagekit] Python fork() question

Sebastian Heinlein glatzor at ubuntu.com
Tue Mar 4 04:05:36 PST 2008


Am Montag, den 03.03.2008, 13:25 -0500 schrieb Robin Norwood:
> On Mon, 03 Mar 2008 16:09:50 +0000
> Richard Hughes <hughsient at gmail.com> wrote:
> 
> > On Mon, 2008-03-03 at 16:46 +0100, Sebastian Heinlein wrote:
> > > Could we perhaps use a simple worker which is based on
> > > threading.thread?
> > 
> > If you think you can do better than fork (and I'm a complete novice
> > when it comes to all this unix stuff) then feel free to have a play
> > and commit on the origin/forked-dbus-backend branch. If it works
> > better than rnorwoods fork then we can merge to master.
> 
> Yeah, I went with forking because:
> 
> a) I'm more familiar with forking than threading

It seems that forking is not well supported by dbus:

http://lists.freedesktop.org/archives/dbus/2007-April/007508.html

Is this still the case, David?

But could forking still be used if we quit the main loop in the child
process and only emit signals?

> b) I've heard that python's threading implementation leaves a lot to be
> desired.

The c interpreter of python cannot use native threads. But since we
don't rely on performance it should be ok.

But a problem could be how to move the cache object to the working
thread.

I attached a patch which should make the code clearer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fork.patch
Type: text/x-patch
Size: 3205 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/packagekit/attachments/20080304/0259b6a9/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
URL: <http://lists.freedesktop.org/archives/packagekit/attachments/20080304/0259b6a9/attachment-0004.pgp>


More information about the PackageKit mailing list