00001 //--------------------------------------------------------------- 00002 // Go4 Release Package v2.10-5 (build 21005) 00003 // 03-Nov-2005 00004 //--------------------------------------------------------------- 00005 // The GSI Online Offline Object Oriented (Go4) Project 00006 // Experiment Data Processing at DVEE department, GSI 00007 //--------------------------------------------------------------- 00008 // 00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI 00010 // Planckstr. 1, 64291 Darmstadt, Germany 00011 //Contact: http://go4.gsi.de 00012 //---------------------------------------------------------------- 00013 //This software can be used under the license agreements as stated 00014 //in Go4License.txt file which is part of the distribution. 00015 //---------------------------------------------------------------- 00016 #include "TGo4CintLockTimer.h" 00017 00018 #include <iostream> 00019 #include "TThread.h" 00020 #include "TApplication.h" 00021 #include "Go4Log/TGo4Log.h" 00022 #include "Go4LockGuard/TGo4LockGuard.h" 00023 00024 00025 UInt_t TGo4CintLockTimer::fguTHREADTIME = 50; 00026 00027 00028 00029 TGo4CintLockTimer::TGo4CintLockTimer (Long_t msperiod, Bool_t mode) 00030 :TTimer(msperiod,mode),fbHaveLock(kFALSE) 00031 { 00032 TGo4LockGuard main; // make sure that main mutex is initialized 00033 } 00034 00035 00036 TGo4CintLockTimer::~TGo4CintLockTimer() 00037 { 00038 } 00039 00040 00041 00042 Bool_t TGo4CintLockTimer::Notify () 00043 { 00044 //TurnOff(); 00045 if(fbHaveLock) 00046 { 00047 if(TThread::Exists()) TGo4LockGuard::fgxMainMutex->UnLock(); 00048 //cout <<"U TGo4CintLockTimer unlocked" << endl; 00049 fbHaveLock=kFALSE; 00050 } 00051 00052 gSystem->Sleep(fguTHREADTIME); 00053 if(!fbHaveLock) 00054 { 00055 if(TThread::Exists()) TGo4LockGuard::fgxMainMutex->Lock(); 00056 //cout <<"L TGo4CintLockTimer has lock" << endl; 00057 fbHaveLock=kTRUE; 00058 } 00059 Reset(); 00060 //TurnOn(); 00061 return kFALSE; 00062 } 00063 00064 00065 00066 00067 00068 00069 //----------------------------END OF GO4 SOURCE FILE ---------------------