#pragma once #include "DoubleBuffer.h" #include #include #include class FIFO : public Retainable { public: enum Direction { Neither, Reader, Writer }; static Retained create(); void open(Direction); void close(Direction); ssize_t write(const byte*, ssize_t); ssize_t read(byte*, ssize_t); bool can_read() const; bool can_write() const; private: FIFO(); unsigned m_writers { 0 }; unsigned m_readers { 0 }; DoubleBuffer m_buffer; };