~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lock.py

  • Committer: Aaron Bentley
  • Date: 2006-03-07 05:59:14 UTC
  • mfrom: (1558.1.20 Aaron's integration)
  • mto: This revision was merged to the branch mainline in revision 1595.
  • Revision ID: aaron.bentley@utoronto.ca-20060307055914-a88728997afceb90
MergeĀ fromĀ mainline

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
2
2
 
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
 
18
 
"""Locking wrappers.
 
18
"""Locking using OS file locks or file existence.
19
19
 
20
 
This only does local locking using OS locks for now.
 
20
Note: This method of locking is generally deprecated in favour of LockDir, but
 
21
is used to lock local WorkingTrees, and by some old formats.  It's accessed
 
22
through Transport.lock_read(), etc.
21
23
 
22
24
This module causes two methods, lock() and unlock() to be defined in
23
25
any way that works on the current platform.
24
26
 
25
27
It is not specified whether these locks are reentrant (i.e. can be
26
28
taken repeatedly by a single process) or whether they exclude
27
 
different threads in a single process.  
28
 
 
29
 
Eventually we may need to use some kind of lock representation that
30
 
will work on a dumb filesystem without actual locking primitives.
 
29
different threads in a single process.  That reentrancy is provided by 
 
30
LockableFiles.
31
31
 
32
32
This defines two classes: ReadLock and WriteLock, which can be
33
33
implemented in different ways on different platforms.  Both have an
250
250
        except ImportError:
251
251
            raise NotImplementedError("please write a locking method "
252
252
                                      "for platform %r" % sys.platform)
253
 
 
254
 
 
255
 
 
256
 
 
257
 
 
258
 
 
259