]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MONITOR/alistoragemanager/alistorage.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / MONITOR / alistoragemanager / alistorage.cxx
1 #include "AliStorageClientThread.h"
2 #include "AliStorageServerThread.h"
3
4 #include <iostream>
5
6 using namespace std;
7
8 void *ClientThreadHandle(void*)
9 {
10         cout<<"ALICE Storage Manager -- Starting client thread"<<endl;
11         AliStorageClientThread *client = new AliStorageClientThread();
12
13         if(client)
14         {
15                 client->CollectData();
16         }
17         else
18         {
19                 cout<<"ALICE Storage Manager -- ERROR - failed to start client thread!!"<<endl;
20         }
21         
22         if(client){delete client;}
23         return 0;
24 }
25
26 void *ServerThreadHandle(void*)
27 {
28         cout<<"\nALICE Storage Manager -- Starting server thread"<<endl;
29
30 #ifdef ZMQ
31         cout<<"ZMQ found"<<endl;
32 #else
33         cout<<"no ZMQ found"<<endl;
34 #endif
35         
36         AliStorageServerThread *server = new AliStorageServerThread();
37
38         if(!server)
39         {
40                 cout<<"ALICE Storage Manager -- ERROR - failed to start server thread!!"<<endl;
41         }
42         if(server){delete server;}
43         return 0;
44 }
45
46 int main()
47 {
48         TThread *clientThread = new TThread("clientThread", ClientThreadHandle,NULL);
49         
50         TThread *serverThread = new TThread("serverThread", ServerThreadHandle,NULL);
51         clientThread->Run();
52         serverThread->Run();
53         
54         clientThread->Join();
55         serverThread->Kill();//if client thread if finished, server thread is killed    
56         return 0;
57 }