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

Go to the documentation of this file.
00001 #ifndef PTHR_WRITER_BUF_POOL_H
00002 #define PTHR_WRITER_BUF_POOL_H
00003 
00004 #include "DistBossUtil/AutoEnlargeBuffer.h"
00005 #include "IRawFile/RawFileExceptions.h"
00006 #include "IRawFile/IRawWriter.h"
00007 #include <semaphore.h>
00008 #include <pthread.h>
00009 
00010 template <typename Writer, int PoolSize = 8>
00011 class PthrWriterBufPool : virtual IRawWriter
00012 {
00013    public :
00014 
00015       PthrWriterBufPool(typename Writer::WriterArgType& arg);
00016       virtual ~PthrWriterBufPool();
00017 
00018       int writeEvent(void* pevt, int size);
00019       int stat();
00020 
00021 
00022    private :
00023 
00024       static void*  thread_writing(void* arg);
00025 
00026       PthrWriterBufPool();  //stop default
00027 
00028 
00029    private :
00030 
00031       int                 m_inLoop;
00032       int                 m_outLoop;
00033       AutoEnlargeBuffer*  m_buf[PoolSize];
00034 
00035       Writer*             m_writer;
00036 
00037       pthread_t           m_tid;
00038       sem_t               m_semIn;
00039       sem_t               m_semOut;
00040 
00041       sem_t               m_semFinalize;
00042 };
00043 
00044 #include "DistBossUtil/template/PthrWriterBufPool.cc"
00045 
00046 #endif

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