1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:07:46 +00:00

Kernel: Move FIFO into FileSystem/ and Socket+LocalSocket into Net/.

This commit is contained in:
Andreas Kling 2019-04-06 20:29:48 +02:00
parent f2580dcfeb
commit 644c887594
15 changed files with 20 additions and 20 deletions

31
Kernel/FileSystem/FIFO.h Normal file
View file

@ -0,0 +1,31 @@
#pragma once
#include "DoubleBuffer.h"
#include <AK/Retainable.h>
#include <AK/RetainPtr.h>
#include <Kernel/UnixTypes.h>
class FIFO : public Retainable<FIFO> {
public:
enum Direction {
Neither, Reader, Writer
};
static Retained<FIFO> 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;
};