GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
GFDataExchanger.h
1 
29 #pragma once
30 
31 #include <queue>
32 
33 namespace GpgFrontend {
34 
36  public:
37  explicit GFDataExchanger(ssize_t size);
38 
39  auto Write(const std::byte* buffer, size_t size) -> ssize_t;
40 
41  auto Read(std::byte* buffer, size_t size) -> ssize_t;
42 
43  void CloseWrite();
44 
45  private:
46  std::condition_variable not_full_, not_empty_;
47  std::queue<std::byte> queue_;
48  std::mutex mutex_;
49  const ssize_t queue_max_size_;
50  std::atomic_bool close_ = false;
51 };
52 
53 } // namespace GpgFrontend
Definition: GFDataExchanger.h:35
Definition: app.cpp:38