Method objects and locking

Robert Collins robertc at robertcollins.net
Mon Nov 28 03:53:52 GMT 2005


On Sun, 2005-11-27 at 22:39 -0500, Aaron Bentley wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Robert Collins wrote:
> | I noticed in a recent patch the following idiom with a MethodObject
> | pattern:
> |
> |
> | class MethodObject:
> |     def __init__(self, branch):
> |         self.branch = branch
> |         self.something = self.branch.get_something()
> |
> |     def doTheThing(self):
> |         self.branch.lock_read()
> |         ...
> 
> The actual code Robert's referring to is bzrlib.check.Check, where
> Branch._get_inventory_weave is called in the constructor.  I'm not sure
> why I did that, but he's absolutely right about the race condition.

It is fixed in my integration branch FWIW ;).

Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051128/c60d394e/attachment.pgp 


More information about the bazaar mailing list