31 int write(
const uint8_t* data,
size_t length);
32 int write(std::string_view data);
35 int read(uint8_t* buffer,
size_t buffer_size);
38 std::optional<std::string>
read_string(
size_t max_size = 65536);
54 std::atomic<bool> is_server_{
false};
56 void* handle_ =
nullptr;
57 std::atomic<bool> closing_{
false};
58 std::atomic<bool> connecting_{
false};
60 std::string write_name_;
61 std::atomic<int> read_fd_{-1};
62 std::atomic<int> write_fd_{-1};
63 mutable std::mutex read_fd_mutex_;
64 mutable std::mutex write_fd_mutex_;
65 std::atomic<bool> closing_{
false};
66 std::atomic<bool> read_peer_confirmed_{
false};
NamedPipe(const NamedPipe &)=delete
int write(std::string_view data)
NamedPipe(NamedPipe &&other) noexcept
int read(uint8_t *buffer, size_t buffer_size)
Read data from the pipe. Returns bytes read, or -1 on error. 0 = EOF.
NamedPipe & operator=(const NamedPipe &)=delete
int write(const uint8_t *data, size_t length)
Write data to the pipe. Returns bytes written, or -1 on error.
bool create_server(std::string_view name)
Create and open a pipe as server (creates the pipe).
bool connect_client(std::string_view name)
Connect to an existing pipe as client.
void close()
Close the pipe.
std::optional< std::string > read_string(size_t max_size=65536)
Read all available data as a string.
NamedPipe & operator=(NamedPipe &&other) noexcept
bool is_open() const
Whether the pipe is open.
Definition generated_event_source.hpp:33
@ other
Definition udev_monitor.hpp:26