Re: [Repoze-dev] locking in repoze.lru

2011-12-28 Thread Chris McDonough
On Wed, 2011-12-28 at 18:55 -0500, Jimmy Hartzell wrote:
> I'm reading the repoze.lru repository, which I checked out of
> https://github.com/repoze/repoze.lru.
> 
> I have two questions about the locking:
> 
> 1) It uses explicit self.lock.acquire and self.lock.release's. Is there a
> reason it's not using the with statement?

It's compatible with Python 2.4, which has no with statement.

> 2) But more interestingly, is there any reason why the get method (lines
> 34-45 in lru's __init__.py) doesn't seem to be protected with locks?

IIRC, I analyzed it and decided that get didn't need any locking, that
the unserialized access to "self.clock" and "self.hand" that it does are
effectively harmless.  If you have info to the contrary, I'd like to
hear it.

Thanks!

- C


> 
> - Jimmy Hartzell
> 
> ___
> Repoze-dev mailing list
> Repoze-dev@lists.repoze.org
> http://lists.repoze.org/listinfo/repoze-dev
> 


___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] locking in repoze.lru

2011-12-28 Thread Jimmy Hartzell
I'm reading the repoze.lru repository, which I checked out of
https://github.com/repoze/repoze.lru.

I have two questions about the locking:

1) It uses explicit self.lock.acquire and self.lock.release's. Is there a
reason it's not using the with statement?

2) But more interestingly, is there any reason why the get method (lines
34-45 in lru's __init__.py) doesn't seem to be protected with locks?

- Jimmy Hartzell

___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev