00001 // $Id: TGo4CintLockTimer.cxx 999 2013-07-25 11:58:59Z linev $ 00002 //----------------------------------------------------------------------- 00003 // The GSI Online Offline Object Oriented (Go4) Project 00004 // Experiment Data Processing at EE department, GSI 00005 //----------------------------------------------------------------------- 00006 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH 00007 // Planckstr. 1, 64291 Darmstadt, Germany 00008 // Contact: http://go4.gsi.de 00009 //----------------------------------------------------------------------- 00010 // This software can be used under the license agreements as stated 00011 // in Go4License.txt file which is part of the distribution. 00012 //----------------------------------------------------------------------- 00013 00014 #include "TGo4CintLockTimer.h" 00015 00016 #include "TThread.h" 00017 #include "TApplication.h" 00018 00019 #include "TGo4Log.h" 00020 #include "TGo4AnalysisClient.h" 00021 00022 UInt_t TGo4CintLockTimer::fguTHREADTIME = 50;//50 00023 00024 TGo4CintLockTimer::TGo4CintLockTimer (TGo4AnalysisClient* parent,Long_t msperiod, Bool_t mode) : 00025 TTimer(msperiod,mode), fbHaveLock(kFALSE), fxParent(parent) 00026 { 00027 } 00028 00029 TGo4CintLockTimer::~TGo4CintLockTimer() 00030 { 00031 if(fbHaveLock) fxParent->UnLockAll(); 00032 } 00033 00034 Bool_t TGo4CintLockTimer::Notify() 00035 { 00036 //TurnOff(); 00037 if(fbHaveLock) 00038 { 00039 //if(TThread::Exists()) TGo4LockGuard::UnLockMainMutex(); 00040 fxParent->UnLockAll(); 00041 //std::cout <<"U TGo4CintLockTimer unlocked" << std::endl; 00042 fbHaveLock=kFALSE; 00043 } 00044 00045 gSystem->Sleep(fguTHREADTIME); 00046 if(!fbHaveLock) 00047 { 00048 //if(TThread::Exists()) TGo4LockGuard::LockMainMutex(); 00049 fxParent->LockAll(); 00050 //std::cout <<"L TGo4CintLockTimer has lock" << std::endl; 00051 fbHaveLock=kTRUE; 00052 } 00053 Reset(); 00054 //TurnOn(); 00055 return kFALSE; 00056 } 00057 00058 00059 00060 00061