BOSS 7.0.5
BESIII Offline Software System
Loading...
Searching...
No Matches
InstallArea/include/DistBossUtil/DistBossUtil/PthrWriterBufPool.h
Go to the documentation of this file.
1#ifndef PTHR_WRITER_BUF_POOL_H
2#define PTHR_WRITER_BUF_POOL_H
3
4#include "DistBossUtil/AutoEnlargeBuffer.h"
5#include "IRawFile/RawFileExceptions.h"
6#include "IRawFile/IRawWriter.h"
7#include <semaphore.h>
8#include <pthread.h>
9
10template <typename Writer, int PoolSize = 8>
11class PthrWriterBufPool : virtual IRawWriter
12{
13 public :
14
15 PthrWriterBufPool(typename Writer::WriterArgType& arg);
17
18 int writeEvent(void* pevt, int size);
19 int stat();
20
21
22 private :
23
24 static void* thread_writing(void* arg);
25
26 PthrWriterBufPool(); //stop default
27
28
29 private :
30
31 int m_inLoop;
32 int m_outLoop;
33 AutoEnlargeBuffer* m_buf[PoolSize];
34
35 Writer* m_writer;
36
37 pthread_t m_tid;
38 sem_t m_semIn;
39 sem_t m_semOut;
40
41 sem_t m_semFinalize;
42};
43
44#include "DistBossUtil/template/PthrWriterBufPool.cc"
45
46#endif
double arg(const EvtComplex &c)
Definition: EvtComplex.hh:227
virtual ~PthrWriterBufPool()
int writeEvent(void *pevt, int size)
PthrWriterBufPool(typename Writer::WriterArgType &arg)