GUIModelSubscriber.cxx
Go to the documentation of this file.
2 #include <unistd.h>
4 using namespace om;
5 
6 static bool gsLock = false;
7 
8 //......................................................................
9 
11 {
12  GUIModel::Instance().Subscribe(this, which);
13 }
14 
15 //......................................................................
16 
18 {
20 }
21 
22 //......................................................................
23 
25 {
26  unsigned int i;
27  const unsigned int kSleep = 1000; // 1 msec
28  const unsigned int kCount = 10000; // 10k tries at 1 msec = 10 seconds
29  for (i=0; i<kCount; ++i) {
30  if (gsLock==false) {
31  gsLock = true;
32  return true;
33  }
34  usleep(kSleep);
35  }
36  return false;
37 }
38 
39 //......................................................................
40 
42 {
43  gsLock = false;
44 }
45 
46 ////////////////////////////////////////////////////////////////////////
GUIModelSubscriber(unsigned int which)
void Subscribe(GUIModelSubscriber *s, unsigned int which)
Definition: GUIModel.cxx:35
static GUIModel & Instance()
Definition: GUIModel.cxx:11
void Unsubscribe(GUIModelSubscriber *s)
Definition: GUIModel.cxx:43
static bool gsLock
static const unsigned int kSleep
Definition: IPC.cxx:21
Online Monitoring package header.