MIDAS
Loading...
Searching...
No Matches
tmfe_example_multithread.cxx File Reference
#include <stdio.h>
#include <signal.h>
#include <assert.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include "midas.h"
#include "tmfe.h"
Include dependency graph for tmfe_example_multithread.cxx:

Go to the source code of this file.

Classes

class  Myfe
 

Functions

static void usage ()
 
int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char argv[] 
)

Definition at line 89 of file tmfe_example_multithread.cxx.

90{
93
95
96 std::vector<std::string> eq_args;
97
98 //std::string name = "";
99 //
100 //if (argc == 2) {
101 // name = argv[1];
102 //} else {
103 // usage(); // DOES NOT RETURN
104 //}
105
107
108 TMFeResult result = mfe->Connect("tmfe_example_mt", __FILE__);
109 if (result.error_flag) {
110 fprintf(stderr, "Cannot connect to MIDAS, error \"%s\", bye.\n", result.error_message.c_str());
111 return 1;
112 }
113
114 //mfe->SetWatchdogSec(0);
115
116 TMFeEquipment* eq = new Myfe("tmfe_example_mt", __FILE__);
117 eq->fEqConfEventID = 1;
118 eq->fEqConfLogHistory = 1;
119 eq->fEqConfPeriodMilliSec = 1000; // milliseconds
120 eq->fEqConfBuffer = "SYSTEM";
121
122 eq->EqInit(eq_args);
123 eq->EqSetStatus("Starting...", "white");
124
125 mfe->AddRpcHandler(eq);
126
127 //mfe->SetTransitionSequenceStart(910);
128 //mfe->SetTransitionSequenceStop(90);
129
130 //mfe->DeregisterTransitionPause();
131 //mfe->DeregisterTransitionResume();
132
133 //mfe->RegisterTransitionStartAbort();
134
135 printf("Main thread is %s\n", TMFE::GetThreadId().c_str());
136
137 mfe->StartRpcThread();
138 //mfe->StartPeriodicThread();
139
140 eq->EqSetStatus("Started...", "white");
141
142 while (!mfe->fShutdownRequested) {
143 ::sleep(1);
144 }
145
146 mfe->Disconnect();
147
148 return 0;
149}
Definition tmfe.h:381
static std::string GetThreadId()
return identification of this thread
Definition tmfe.cxx:1140
static TMFE * Instance()
Definition tmfe.cxx:57
bool error_flag
Definition tmfe.h:89
std::string error_message
Definition tmfe.h:91
std::vector< FMT_ID > eq
Definition mdump.cxx:55
#define sleep(ms)
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
Here is the call graph for this function:

◆ usage()

static void usage ( )
static

Definition at line 83 of file tmfe_example_multithread.cxx.

84{
85 fprintf(stderr, "Usage: tmfe_example_mt ...\n");
86 exit(1);
87}
Here is the call graph for this function: