[merge] CountedLock class

Martin Pool mbp at sourcefrog.net
Thu May 3 07:35:10 BST 2007


This adds a simple CountedLock class.  Basically all this does is
decorate a lock so that it's reentrant: you can acquire it several
times, and only the initial acquisition and release is passed through
to the underlying lock.

This patch doesn't use it anywhere aside from the test suite, but it's
easy to review.  If this is OK I need to make it pass through lock
tokens and decide what to do with the more exotic options like
leave_in_place.  Then I'll make LockableFiles use this, then make the
Branches etc create one of these rather than locking through
LockableFiles.

This is a start towards cleaning up the LockableFiles class, which
gloms together a few things at the moment: counted locks, encoding of
control files as utf8, and setting default modes on control files.  It
acts as a passthrough on the transport but without adding much value,
and possibly causing inconsistency if code also uses the transport
directly.  Also this has unit tests, which LockableFiles does not.

-- 
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20070403-counted-locks.diff
Type: text/x-diff
Size: 9637 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070503/fcd70dd0/attachment.bin 


More information about the bazaar mailing list