BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
ReaderRpc< Reader > Class Template Reference

#include <ReaderRpc.h>

+ Inheritance diagram for ReaderRpc< Reader >:

Public Member Functions

 ReaderRpc (const std::string &svrName, const std::vector< std::string > &fnames, int evtMax)
 
virtual ~ReaderRpc ()
 
int wait_to_end ()
 
- Public Member Functions inherited from RpcInterface
virtual ~RpcInterface ()
 
virtual int wait_to_end ()=0
 

Detailed Description

template<class Reader>
class ReaderRpc< Reader >

Definition at line 13 of file ReaderRpc.h.

Constructor & Destructor Documentation

◆ ReaderRpc()

template<class Reader >
ReaderRpc< Reader >::ReaderRpc ( const std::string &  svrName,
const std::vector< std::string > &  fnames,
int  evtMax 
)

Definition at line 9 of file ReaderRpc.cc.

10 : DimRpc(svrName.c_str(), "I", "I"),
11 m_evtDone(0),
12 m_evtMax(evtMax),
13 m_stopFlag(0)
14{
15 sem_init(&m_sem, 0, 0);
16 m_freader = new PthrReaderBufPool<Reader>( fnames );
17
18 m_svrName = svrName.substr( svrName.find_last_of('/')+1 );
19}

◆ ~ReaderRpc()

template<class Reader >
ReaderRpc< Reader >::~ReaderRpc
virtual

Definition at line 22 of file ReaderRpc.cc.

23{
24 sem_destroy(&m_sem);
25
26 delete m_freader;
27
28 for (std::map<int, AutoEnlargeBuffer*>::iterator it = m_evtBak.begin(); it != m_evtBak.end(); ++it) {
29 delete it->second;
30 }
31
32 std::cout << "[" << m_svrName << "] Terminated. Total events processed: " << m_evtDone << std::endl;
33}

Member Function Documentation

◆ wait_to_end()

template<class Reader >
int ReaderRpc< Reader >::wait_to_end
virtual

Implements RpcInterface.

Definition at line 36 of file ReaderRpc.cc.

37{
38 sem_wait(&m_sem);
39
40 int nClients = dis_get_n_clients(itsIdOut);
41
42 int i = 0;
43 while ( nClients > 0 ) {
44 // wait for all the clients dis-connecting to this server
45 // and force the server to stop when the total waiting time
46 // is greater than 5s(5*1s)
47 if ( ++i > 5 ) break;
48 sleep(1);
49 nClients = dis_get_n_clients(itsIdOut);
50 }
51
52 return nClients;
53}

The documentation for this class was generated from the following files: