btllib

process_pipeline.hpp
1#ifndef BTLLIB_PROCESS_PIPELINE_HPP
2#define BTLLIB_PROCESS_PIPELINE_HPP
3
4#include <atomic>
5#include <cstdio>
6#include <string>
7
8 namespace btllib {
9
10 using PipeId = unsigned long;
11 using PipelineId = unsigned long;
12
17 class ProcessPipeline
18{
19
20 public:
29 ProcessPipeline(const std::string& cmd);
30 ~ProcessPipeline() { end(); }
31
32 void close_in();
33 void close_out();
34
35 void end();
36
37 FILE *in = nullptr, *out = nullptr;
38 std::atomic<bool> in_closed{ false };
39 std::atomic<bool> out_closed{ false };
40
41 private:
42 PipelineId id = 0;
43 std::atomic<bool> ended{ false };
44};
45
46} // namespace btllib
47
48#endif
btllib::ProcessPipeline
Definition: process_pipeline.hpp:18
btllib::ProcessPipeline::ProcessPipeline
ProcessPipeline(const std::string &cmd)
btllib
Definition: bloom_filter.hpp:16