Gentoo Archives: gentoo-portage-dev

From: Paul Varner <fuzzyray@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] PATCH: gentoolkit: Make portage.config object a global object
Date: Wed, 21 Sep 2005 01:15:21
Message-Id: 1127265280.21080.8.camel@garath.homelinux.org
In Reply to: Re: [gentoo-portage-dev] PATCH: gentoolkit: Make portage.config object a global object by Brian Harring
1 On Tue, 2005-09-20 at 19:00 -0500, Brian Harring wrote:
2 > On Tue, Sep 20, 2005 at 06:55:44PM -0500, Paul Varner wrote:
3 > > On Tue, 2005-09-20 at 18:34 -0500, Brian Harring wrote:
4 > > > > Updated patch to add a semaphore to control access to the global
5 > > > > portage.config object. Unless anyone sees any other issues with this
6 > > > > patch, I will be placing it into gentoolkit.
7 > > > Reason for a semaphore over threading.Lock ?
8 > >
9 > > No reason other than I'm used to thinking of them as semaphores instead
10 > > of locks, so semaphore is what I searched for in the Python docs.
11 > Need to make some chunks of the rewrite thread safe, so I poked a bit;
12 > python -m timeit -n 10000 -r 3 -s 'import threading;s=threading.Lock()' 's.acquire();s.release()'
13 > around 1us
14 > python -m timeit -n 10000 -r 3 -s 'import threading;s=threading.Semaphore()' 's.acquire();s.release()'
15 > 20us
16 >
17
18 Okay, I've changed the Semaphore to a Lock and removed the
19 self._settings.reset() call.
20
21 Anything else before I commit this?
22
23 Regards,
24 Paul
25
26 PS: As an aside the command 'equery hasuse perl' goes from 34s to 2s on
27 my Pentium 4 with this patch.
28 --
29 gentoo-portage-dev@g.o mailing list