33
|
1 The lockfile package exports a LockFile class which provides a simple API for
|
|
2 locking files. Unlike the Windows msvcrt.locking function, the fcntl.lockf
|
|
3 and flock functions, and the deprecated posixfile module, the API is
|
|
4 identical across both Unix (including Linux and Mac) and Windows platforms.
|
|
5 The lock mechanism relies on the atomic nature of the link (on Unix) and
|
|
6 mkdir (on Windows) system calls. An implementation based on SQLite is also
|
|
7 provided, more as a demonstration of the possibilities it provides than as
|
|
8 production-quality code.
|
|
9
|
|
10 Note: In version 0.9 the API changed in two significant ways:
|
|
11
|
|
12 * It changed from a module defining several classes to a package containing
|
|
13 several modules, each defining a single class.
|
|
14
|
|
15 * Where classes had been named SomethingFileLock before the last two words
|
|
16 have been reversed, so that class is now SomethingLockFile.
|
|
17
|
|
18 The previous module-level definitions of LinkFileLock, MkdirFileLock and
|
|
19 SQLiteFileLock will be retained until the 1.0 release.
|
|
20
|
|
21 Available on GitHub from:
|
|
22
|
|
23 git://github.com/smontanaro/pylockfile.git
|
|
24
|
|
25 To install:
|
|
26
|
|
27 python setup.py install
|