ROOT logo
// @(#)root/thread:$Id: TLockFile.h 28363 2009-04-27 15:12:11Z rdm $
// Author: Jan Fiete Grosse-Oetringhaus, 04.06.07

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TLockFile
#define ROOT_TLockFile

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TLockFile                                                            //
//                                                                      //
// Lock an object using a file.                                         //
// Constructor blocks until lock is obtained. Lock is released in the   //
// destructor.                                                          //
//                                                                      //
// Use it in scope-blocks like:                                         //
// {                                                                    //
//    TLockFile lock("path.to.lock.file");                              //
//    // do something you need the lock for                             //
// } // lock is automatically released                                  //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif


class TLockFile : public TObject {

private:
   TLockFile(const TLockFile&);             // not implemented
   TLockFile& operator=(const TLockFile&);  // not implemented

protected:
   TString fPath;         // path to file holding the lock

   Bool_t Lock(const char *path, Int_t timeLimit);

public:
   TLockFile(const char *path, Int_t timeLimit = 0);
   virtual ~TLockFile();

   ClassDef(TLockFile, 0) //Lock an object using a file
};

#endif
 TLockFile.h:1
 TLockFile.h:2
 TLockFile.h:3
 TLockFile.h:4
 TLockFile.h:5
 TLockFile.h:6
 TLockFile.h:7
 TLockFile.h:8
 TLockFile.h:9
 TLockFile.h:10
 TLockFile.h:11
 TLockFile.h:12
 TLockFile.h:13
 TLockFile.h:14
 TLockFile.h:15
 TLockFile.h:16
 TLockFile.h:17
 TLockFile.h:18
 TLockFile.h:19
 TLockFile.h:20
 TLockFile.h:21
 TLockFile.h:22
 TLockFile.h:23
 TLockFile.h:24
 TLockFile.h:25
 TLockFile.h:26
 TLockFile.h:27
 TLockFile.h:28
 TLockFile.h:29
 TLockFile.h:30
 TLockFile.h:31
 TLockFile.h:32
 TLockFile.h:33
 TLockFile.h:34
 TLockFile.h:35
 TLockFile.h:36
 TLockFile.h:37
 TLockFile.h:38
 TLockFile.h:39
 TLockFile.h:40
 TLockFile.h:41
 TLockFile.h:42
 TLockFile.h:43
 TLockFile.h:44
 TLockFile.h:45
 TLockFile.h:46
 TLockFile.h:47
 TLockFile.h:48
 TLockFile.h:49
 TLockFile.h:50
 TLockFile.h:51
 TLockFile.h:52
 TLockFile.h:53
 TLockFile.h:54
 TLockFile.h:55
 TLockFile.h:56
 TLockFile.h:57