Package gofer :: Package agent :: Module lock :: Class LockFile
[hide private]
[frames] | no frames]

Class LockFile

source code

File based locking.

Instance Methods [hide private]
 
__init__(self, path) source code
LockFile
acquire(self, blocking=True)
Acquire the lockfile.
source code
 
release(self)
Release the lockfile.
source code
int
getpid(self)
Get the process id.
source code
 
setpid(self, pid=22432)
Write our procecss id and flush.
source code
 
__mkdir(self, path) source code
Instance Variables [hide private]
file-like pointer. __fp
The file pointer to the lock file.
str path
The absolute path to the lock file.
Method Details [hide private]

__init__(self, path)
(Constructor)

source code 
Parameters:
  • path (str) - The absolute path to the lock file.

acquire(self, blocking=True)

source code 

Acquire the lockfile.

Parameters:
  • blocking (bool) - Wait for the lock.
Returns: LockFile
self

getpid(self)

source code 

Get the process id.

Returns: int
The pid in the lock file, else the current pid.

setpid(self, pid=22432)

source code 

Write our procecss id and flush.

Parameters:
  • pid (int) - The process ID.