22 throw std::ios_base::failure(
"Could not create TokenPipe");
29SignalInterrupt::operator bool()
const {
44 std::unique_lock<std::mutex> lk(m_mutex);
52 if (!
m_flag.exchange(
true)) {
56 throw std::ios_base::failure(
"Could not write interrupt token");
64 std::unique_lock<std::mutex> lk(m_mutex);
65 m_cv.wait(lk, [
this] {
return m_flag.load(); });
69 throw std::ios_base::failure(
"Did not read expected interrupt token");
int TokenWrite(uint8_t token)
Write token to endpoint.
int TokenRead()
Read token from endpoint.
static std::optional< TokenPipe > Make()
Create a new pipe.
std::atomic< bool > m_flag