summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskip.montanaro <skip.montanaro@gmail.com>2010-11-08 02:27:18 +0000
committerskip.montanaro <skip.montanaro@gmail.com>2010-11-08 02:27:18 +0000
commit72541ae9f9fab72da6b2ae991624735c5881a9cd (patch)
treee5422c45320f772c919eabf718ba854ca5924f55
parent8c98bab3796b2066809c8a74d0e60e844de95a70 (diff)
downloadlockfile-72541ae9f9fab72da6b2ae991624735c5881a9cd.tar.gz
Catch up on a little documentation.
-rw-r--r--doc/lockfile.rst19
1 files changed, 19 insertions, 0 deletions
diff --git a/doc/lockfile.rst b/doc/lockfile.rst
index 4bc0a3e..94598a8 100644
--- a/doc/lockfile.rst
+++ b/doc/lockfile.rst
@@ -112,6 +112,12 @@ The following classes are provided:
optional, but when set to :const:`True` locks will be distinguished
between threads in the same process.
+.. class:: symlinklockfile.SymlinkLockFile(path, threaded=True)
+
+ This class uses the :func:`symlink(2)` system call as the basic lock
+ mechanism. The parameters have the same meaning as for the
+ :class:`LinkLockFile` class.
+
.. class:: mkdirlockfile.MkdirLockFile(path, threaded=True)
This class uses the :func:`mkdir(2)` system call as the basic lock
@@ -130,6 +136,11 @@ The following classes are provided:
at the lockfile package level so programmers can implement other locking
schemes.
+.. function:: locked(path, timeout=None)
+
+ This function provides a decorator which insures the decorated function
+ is always called with the lock held.
+
By default, the :const:`LockFile` object refers to the
:class:`mkdirlockfile.MkdirLockFile` class on Windows. On all other
platforms it refers to the :class:`linklockfile.LinkLockFile` class.
@@ -237,6 +248,14 @@ If you don't want to wait forever, you might try::
print "I locked", lock.path
lock.release()
+You can also insure that a lock is always held when appropriately decorated
+functions are called::
+
+ from lockfile import locked
+ @locked("/tmp/mylock")
+ def func(a, b):
+ return a + b
+
Other Libraries
---------------