46 if (Lock(fPath, timeLimit))
50 Info(
"TLockFile",
"did not aquire lock %s, sleeping...", fPath.Data());
75 Info(
"Lock",
"%s modification time %ld, %ld seconds ago", path, modTime, time(0) - modTime);
76 if (time(0) - modTime > timeLimit){
79 Info(
"Lock",
"time expired, removed %s", path);
87 spath +=
"?filetype=raw";
100 Info(
"Lock",
"obtained lock %s", path);
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
const char * Data() const
virtual int Unlink(const char *name)
Unlink, i.e. remove, a file.
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
void Info(const char *location, const char *msgfmt,...)
R__EXTERN TSystem * gSystem
ClassImp(TLockFile) TLockFile
Default constructor.
virtual int Chmod(const char *file, UInt_t mode)
Set the file permission bits. Returns -1 in case or error, 0 otherwise.
A scoped lock based on files.
virtual ~TLockFile()
Destructor. Releases the lock.
Bool_t Lock(const char *path, Int_t timeLimit)
Internal function that locks with the given path.
TString fPath
Path to file holding the lock.
virtual void Close(Option_t *option="")
Close a file.