/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/DistBoss/DistBossUtil/DistBossUtil-00-00-04/DistBossUtil/PthrReaderBufPool.h

Go to the documentation of this file.
00001 #ifndef PTHR_READER_BUF_POOL_H
00002 #define PTHR_READER_BUF_POOL_H
00003 
00004 #include "DistBossUtil/AutoEnlargeBuffer.h"
00005 #include "IRawFile/RawFileExceptions.h"
00006 #include "IRawFile/IRawReader.h"
00007 #include <semaphore.h>
00008 #include <pthread.h>
00009 #include <vector>
00010 #include <string>
00011 
00012 template <typename Reader, int PoolSize = 8>
00013 class PthrReaderBufPool : public IRawReader
00014 {
00015    public :
00016 
00017       PthrReaderBufPool(typename Reader::ReaderArgType& arg);
00018       virtual ~PthrReaderBufPool();
00019 
00020       inline const uint32_t*  nextEvent();
00021       inline const uint32_t*  currentEvent() const;
00022       inline uint32_t         runNo();
00023       inline std::string      currentFile();
00024       inline uint32_t         stat();
00025 
00026 
00027    private :
00028 
00029       static void*  thread_filling(void* arg);
00030 
00031       PthrReaderBufPool();  //stop default
00032 
00033 
00034    private :
00035 
00036       int                 m_inLoop;
00037       int                 m_outLoop;
00038       AutoEnlargeBuffer*  m_buf[PoolSize];
00039 
00040       Reader*             m_reader;
00041 
00042       pthread_t           m_tid;
00043       sem_t               m_semIn;
00044       sem_t               m_semOut;
00045       pthread_mutex_t     m_lock;
00046 
00047       sem_t               m_semSyn;
00048 
00049       // copy of possible exceptions
00050       RawFileException*   m_RawFileException;
00051 };
00052 
00053 #include "DistBossUtil/template/PthrReaderBufPool.cc"
00054 
00055 #endif

Generated on Tue Nov 29 22:58:02 2016 for BOSS_7.0.2 by  doxygen 1.4.7