5#ifndef BITCOIN_UTIL_TOKENPIPE_H
6#define BITCOIN_UTIL_TOKENPIPE_H
89 static std::optional<TokenPipe>
Make();
110 for (
int i = 0; i < 2; ++i) {
111 m_fds[i] = other.m_fds[i];
117 for (
int i = 0; i < 2; ++i) {
118 m_fds[i] = other.m_fds[i];
TokenPipeEnd & operator=(TokenPipeEnd &&other)
TokenPipeEnd(const TokenPipeEnd &)=delete
TokenPipeEnd(TokenPipeEnd &&other)
Status
Return value constants for TokenWrite and TokenRead.
@ TS_EOS
Unexpected end of stream.
bool IsOpen()
Return whether endpoint is open.
int TokenWrite(uint8_t token)
Write token to endpoint.
void Close()
Explicit close function.
TokenPipeEnd & operator=(const TokenPipeEnd &)=delete
int TokenRead()
Read token from endpoint.
An interprocess or interthread pipe for sending tokens (one-byte values) over.
void Close()
Close and end of the pipe that hasn't been moved out.
TokenPipeEnd TakeReadEnd()
Take the read end of this pipe.
TokenPipeEnd TakeWriteEnd()
Take the write end of this pipe.
static std::optional< TokenPipe > Make()
Create a new pipe.
TokenPipe & operator=(TokenPipe &&other)
TokenPipe & operator=(const TokenPipe &)=delete
TokenPipe(TokenPipe &&other)
TokenPipe(const TokenPipe &)=delete
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...