mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:37:44 +00:00
Move DoubleBuffer to its own files.
This commit is contained in:
parent
aff89d2fd7
commit
bbfae19238
5 changed files with 56 additions and 49 deletions
24
Kernel/TTY.h
24
Kernel/TTY.h
|
@ -1,33 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#include "DoubleBuffer.h"
|
||||
#include <VirtualFileSystem/CharacterDevice.h>
|
||||
#include <VirtualFileSystem/UnixTypes.h>
|
||||
|
||||
class Process;
|
||||
|
||||
class DoubleBuffer {
|
||||
public:
|
||||
DoubleBuffer()
|
||||
: m_write_buffer(&m_buffer1)
|
||||
, m_read_buffer(&m_buffer2)
|
||||
{
|
||||
}
|
||||
|
||||
ssize_t write(const byte*, size_t);
|
||||
ssize_t read(byte*, size_t);
|
||||
|
||||
bool is_empty() const { return m_read_buffer_index >= m_read_buffer->size() && m_write_buffer->isEmpty(); }
|
||||
|
||||
private:
|
||||
void flip();
|
||||
|
||||
Vector<byte>* m_write_buffer { nullptr };
|
||||
Vector<byte>* m_read_buffer { nullptr };
|
||||
Vector<byte> m_buffer1;
|
||||
Vector<byte> m_buffer2;
|
||||
size_t m_read_buffer_index { 0 };
|
||||
};
|
||||
|
||||
class TTY : public CharacterDevice {
|
||||
public:
|
||||
virtual ~TTY() override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue