On Tue, 2005-09-20 at 19:00 -0500, Brian Harring wrote:
> On Tue, Sep 20, 2005 at 06:55:44PM -0500, Paul Varner wrote:
> > On Tue, 2005-09-20 at 18:34 -0500, Brian Harring wrote:
> > > > Updated patch to add a semaphore to control access to the global
> > > > portage.config object. Unless anyone sees any other issues with this
> > > > patch, I will be placing it into gentoolkit.
> > > Reason for a semaphore over threading.Lock ?
> > 
> > No reason other than I'm used to thinking of them as semaphores instead
> > of locks, so semaphore is what I searched for in the Python docs.
> Need to make some chunks of the rewrite thread safe, so I poked a bit;
> python -m timeit -n 10000 -r 3 -s 'import threading;s=threading.Lock()' 
> 's.acquire();s.release()'
> around 1us
> python -m timeit -n 10000 -r 3 -s 'import threading;s=threading.Semaphore()' 
> 's.acquire();s.release()'
> 20us
> 

Okay, I've changed the Semaphore to a Lock and removed the
self._settings.reset() call.  

Anything else before I commit this?

Regards,
Paul

PS: As an aside the command 'equery hasuse perl' goes from 34s to 2s on
my Pentium 4 with this patch.
-- 
gentoo-portage-dev@gentoo.org mailing list

Reply via email to