houxiao
2017-01-09 0b1de1fddd889cf2ebbe578bfad83862f5ebdf5a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef _PIPELINEPOOL_H_
#define _PIPELINEPOOL_H_
 
#include "PipeLine.h"
#include <set>
 
class PipeLinePool
{
public:
    PipeLinePool(bool _multithread_safe = false);
    ~PipeLinePool();
    
    void manage(PipeLine* pl);
    void unmanage(PipeLine* pl);
    
    PipeLine* get_free();
    void release(PipeLine* pl);
    
    bool wait_free();
    bool notify_free();
 
private:
    bool multithread_safe;
 
    void* tsafe_mutex;
    void* pl_mutex;
 
    typedef std::set<PipeLine*> pl_set_t;
    pl_set_t pipelines;
    pl_set_t pipelines_free;
};
 
#endif