std1.0.0-beta-7 SafeC docs

Module ipc::pipe

#include <std/ipc/pipe.h> source

Anonymous Pipes

The simplest form of hosted inter-process communication: a one-way byte stream with a read end and a write end, most commonly used for parent- child communication (a spawned child process inherits the pipe fds/ handles, or they're wired to its stdin/stdout — that wiring itself is out of scope here, this module only creates and operates the pipe).

Handles are 'long long' uniformly across platforms — a POSIX pipe fd fits directly; a Windows pipe HANDLE (a pointer-sized value) is stored via the same pointer-to-integer convention std::thread.h's OS-thread handles already use.

Pipe conforms to io_traits.h's Stream (Reader + Writer: read from the read end, write to the write end), so read_exact / write_all / copy_stream and io_buf.h's BufReader / BufWriter work on it.

Backends (picked the same way as std/sched/reactor.h's):

pipe_posix.sc  — macOS, iOS, Linux, Android, FreeBSD (pipe() is
                 identical across all of these — no per-OS split
                 needed the way sockaddr_in required one)
pipe_win32.sc  — Windows (CreatePipe/ReadFile/WriteFile/CloseHandle)

Structs

Pipe