summaryrefslogtreecommitdiff
path: root/Kernel/TTY.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-12-03 01:51:44 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-12-03 01:51:44 +0100
commitbbfae19238cebaeb953960c2c4f147d9bb3e9fca (patch)
tree4d80915d468675d741864acaa32f932669d5e5e7 /Kernel/TTY.h
parentaff89d2fd7c8653b29adb06d19fcc857f886a866 (diff)
downloadserenity-bbfae19238cebaeb953960c2c4f147d9bb3e9fca.zip
Move DoubleBuffer to its own files.
Diffstat (limited to 'Kernel/TTY.h')
-rw-r--r--Kernel/TTY.h24
1 files changed, 1 insertions, 23 deletions
diff --git a/Kernel/TTY.h b/Kernel/TTY.h
index a5e6385489..eb1f18d74f 100644
--- a/Kernel/TTY.h
+++ b/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;