22 if (!pipe)
throw std::ios_base::failure(
"Could not create TokenPipe");
23 m_pipe_r = pipe->TakeReadEnd();
24 m_pipe_w = pipe->TakeWriteEnd();
28 SignalInterrupt::operator bool()
const 37 if (*
this && !
wait())
return false;
45 std::unique_lock<std::mutex> lk(m_mutex);
52 if (!
m_flag.exchange(
true)) {
66 std::unique_lock<std::mutex> lk(m_mutex);
67 m_cv.wait(lk, [
this] {
return m_flag.load(); });
int TokenWrite(uint8_t token)
Write token to endpoint.
std::atomic< bool > m_flag
int TokenRead()
Read token from endpoint.
static std::optional< TokenPipe > Make()
Create a new pipe.