]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MONITOR/AliDimIntNotifier.cxx
new option for tests in alifakedisplay
[u/mrichter/AliRoot.git] / MONITOR / AliDimIntNotifier.cxx
index 99de6c2dd26d4e7a502676bbf6866a325e658e23..8353f2882679f127f7f4996373eb2cbe8f55eb01 100644 (file)
@@ -7,9 +7,10 @@
  * full copyright notice.                                                 *
  **************************************************************************/
 
-#include "AliDimIntNotifier.h"
+#include <TError.h>
+#include <TSystem.h>
 
-#include <signal.h>
+#include "AliDimIntNotifier.h"
 
 //______________________________________________________________________________
 // Full description of AliDimIntNotifier
 
 ClassImp(AliDimIntNotifier)
 
-Long_t AliDimIntNotifier::fgMainThreadId = 0;
-
-void AliDimIntNotifier::SetMainThreadId()
-{
-  fgMainThreadId = TThread::SelfId();
-}
-
 AliDimIntNotifier::AliDimIntNotifier(const TString& service) :
   DimUpdatedInfo(service, -1),
-  fNotifyLck(kTRUE),
-  fNotifyCnd(&fNotifyLck),
   fLastMessage(-1)
 {
-  fReThreader.Connect("Timeout()", "AliDimIntNotifier", this, "DimMessage()");
-}
-
-void AliDimIntNotifier::StartTimer()
-{
-  fReThreader.Reset();
-  fReThreader.TurnOn();
-  pthread_kill((pthread_t)fgMainThreadId, SIGALRM); 
-}
 
-void AliDimIntNotifier::StopTimer()
-{
-  fReThreader.TurnOff();
 }
 
 void AliDimIntNotifier::infoHandler()
 {
-  // Handle DIM message
-
-  fNotifyLck.Lock();
-  fLastMessage = getData() ? getInt() : -1;
-  if (TThread::SelfId() != fgMainThreadId)
-  {
-    StartTimer();
-    fNotifyCnd.Wait();
-  }
-  else
-  {
-    Warning("infoHandler", "DIM message received from CINT thread.");
-    DimMessage();
-  }
-  fNotifyLck.UnLock();
-}
-
-void AliDimIntNotifier::infoHandlerTest(Int_t fake)
-{
-  // Fake handler for testing.
-
-  fNotifyLck.Lock();
-  fLastMessage = fake;
-  if (TThread::SelfId() != fgMainThreadId)
-  {
-    StartTimer();
-    fNotifyCnd.Wait();
-  }
-  else
-  {
-    Warning("infoHandlerTest", "Was called from CINT thread ...");
-    DimMessage();
-  }
-  fNotifyLck.UnLock();
+       // Handle DIM message
+       fLastMessage = getData() ? getInt() : -1;
+       DimMessage(fLastMessage);
 }
 
 void AliDimIntNotifier::DimMessage(Int_t)
 {
-  StopTimer();
+
   if (fLastMessage != -1)
   {
     Emit("DimMessage(Int_t)", fLastMessage);
-    printf("Notify %d\n", fLastMessage);
-  }
-  else
-  {
-    printf("NOTNotify %d\n", fLastMessage);
   }
-  fNotifyLck.Lock();
-  fNotifyCnd.Signal();
-  fNotifyLck.UnLock();
+  gSystem->ProcessEvents();
 }