43 TLockFile::TLockFile(
const char *path, Int_t timeLimit) : fPath(path)
46 if (Lock(fPath, timeLimit))
50 Info(
"TLockFile",
"did not aquire lock %s, sleeping...", fPath.Data());
58 TLockFile::~TLockFile()
61 Info(
"~TLockFile",
"releasing lock %s", fPath.Data());
63 gSystem->Unlink(fPath);
69 Bool_t TLockFile::Lock(
const char *path, Int_t timeLimit)
72 if (gSystem->GetPathInfo(path, 0, (Long_t*) 0, 0, &modTime) == 0) {
75 Info(
"Lock",
"%s modification time %ld, %ld seconds ago", path, modTime, time(0) - modTime);
76 if (time(0) - modTime > timeLimit){
77 gSystem->Unlink(path);
79 Info(
"Lock",
"time expired, removed %s", path);
87 spath +=
"?filetype=raw";
88 TFile *file = TFile::Open(spath,
"CREATE");
97 gSystem->Chmod(path, 0666);
100 Info(
"Lock",
"obtained lock %s", path);