BOSS 7.0.5
BESIII Offline Software System
Loading...
Searching...
No Matches
InstallArea/include/DistBossUtil/DistBossUtil/PthrReaderBufPool.h
Go to the documentation of this file.
1#ifndef PTHR_READER_BUF_POOL_H
2#define PTHR_READER_BUF_POOL_H
3
4#include "DistBossUtil/AutoEnlargeBuffer.h"
5#include "IRawFile/RawFileExceptions.h"
6#include "IRawFile/IRawReader.h"
7#include <semaphore.h>
8#include <pthread.h>
9#include <vector>
10#include <string>
11
12template <typename Reader, int PoolSize = 8>
13class PthrReaderBufPool : public IRawReader
14{
15 public :
16
17 PthrReaderBufPool(typename Reader::ReaderArgType& arg);
19
20 inline const uint32_t* nextEvent();
21 inline const uint32_t* currentEvent() const;
22 inline uint32_t runNo();
23 inline std::string currentFile();
24 inline uint32_t stat();
25
26
27 private :
28
29 static void* thread_filling(void* arg);
30
31 PthrReaderBufPool(); //stop default
32
33
34 private :
35
36 int m_inLoop;
37 int m_outLoop;
38 AutoEnlargeBuffer* m_buf[PoolSize];
39
40 Reader* m_reader;
41
42 pthread_t m_tid;
43 sem_t m_semIn;
44 sem_t m_semOut;
45 pthread_mutex_t m_lock;
46
47 sem_t m_semSyn;
48
49 // copy of possible exceptions
50 RawFileException* m_RawFileException;
51};
52
53#include "DistBossUtil/template/PthrReaderBufPool.cc"
54
55#endif
double arg(const EvtComplex &c)
Definition: EvtComplex.hh:227
std::string currentFile()
const uint32_t * nextEvent()
const uint32_t * currentEvent() const
PthrReaderBufPool(typename Reader::ReaderArgType &arg)
virtual ~PthrReaderBufPool()
uint32_t runNo()