10 elif os.name ==
'posix':
13 raise RuntimeError(
"Locker only defined for nt and posix platforms")
18 Lock first 10 bytes of a file.
27 msvcrt.locking(file.fileno(),msvcrt.LK_LOCK,10)
36 Unlock first 10 bytes of a file.
40 msvcrt.locking(file.fileno(),msvcrt.LK_UNLCK,10)
43 elif os.name ==
'posix':
47 fcntl.lockf( file, fcntl.LOCK_EX )
48 except IOError, exc_value:
49 print "Problem when trying to lock {0}, IOError {1}".
format(file, exc_value[0])
54 fcntl.lockf( file, fcntl.LOCK_UN )
68 self.
log = logging.getLogger(
"LockFile")
69 self.log.info(
"%s - Locking on %s", time.strftime(
"%Y-%m-%d_%H:%M:%S"), self.
name)
70 if not os.path.exists(name):
79 self.log.warning(
"Cannot acquire lock on %s", self.
name)
90 self.log.info(
"%s - Lock on %s released", time.strftime(
"%Y-%m-%d_%H:%M:%S"), self.
name)
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".