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