diff options
author | Alexis211 <alexis211@gmail.com> | 2009-09-18 14:26:29 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-09-18 14:26:29 +0200 |
commit | f593816bc9c32a8570cf65697183f314348e8e87 (patch) | |
tree | ae4cb3fbc64834818a6aabe04cfdd429e9da70b5 /Source/Kernel/VTManager | |
parent | 8862994499de563b763607fff3f39a8a28c553b3 (diff) | |
download | Melon-f593816bc9c32a8570cf65697183f314348e8e87.tar.gz Melon-f593816bc9c32a8570cf65697183f314348e8e87.zip |
Changes in mutexes, vectors and VTs :
mutexes now use the atomic_exchang defined in Task.wtf.asm
some vector methods are now declared const
VTs now can display (decimal) 64bit integers
Diffstat (limited to 'Source/Kernel/VTManager')
-rw-r--r-- | Source/Kernel/VTManager/VirtualTerminal-kbd.class.cpp | 4 | ||||
-rw-r--r-- | Source/Kernel/VTManager/VirtualTerminal.class.cpp | 7 | ||||
-rw-r--r-- | Source/Kernel/VTManager/VirtualTerminal.class.h | 5 |
3 files changed, 11 insertions, 5 deletions
diff --git a/Source/Kernel/VTManager/VirtualTerminal-kbd.class.cpp b/Source/Kernel/VTManager/VirtualTerminal-kbd.class.cpp index d40a9a7..7c784fe 100644 --- a/Source/Kernel/VTManager/VirtualTerminal-kbd.class.cpp +++ b/Source/Kernel/VTManager/VirtualTerminal-kbd.class.cpp @@ -4,6 +4,7 @@ using namespace Kbd; void VirtualTerminal::keyPress(keypress_t kp) { + m_kbdbuffMutex.waitLock(); m_kbdbuff.push(kp); if (!m_kbdMutex.locked()) { if (kp.haschar && !kp.hascmd) { @@ -16,6 +17,7 @@ void VirtualTerminal::keyPress(keypress_t kp) { put("\b"); } } + m_kbdbuffMutex.unlock(); } keypress_t VirtualTerminal::getKeypress(bool show, bool block) { @@ -29,12 +31,14 @@ keypress_t VirtualTerminal::getKeypress(bool show, bool block) { while (m_kbdbuff.empty()) Task::currentThread->sleep(10); + m_kbdbuffMutex.waitLock(); keypress_t ret = m_kbdbuff[0]; for (u32int i = 1; i < m_kbdbuff.size(); i++) { m_kbdbuff[i - 1] = m_kbdbuff[i]; } m_kbdbuff.pop(); + m_kbdbuffMutex.unlock(); if (show) { if (ret.haschar && !ret.hascmd) { diff --git a/Source/Kernel/VTManager/VirtualTerminal.class.cpp b/Source/Kernel/VTManager/VirtualTerminal.class.cpp index be1299c..7ee360b 100644 --- a/Source/Kernel/VTManager/VirtualTerminal.class.cpp +++ b/Source/Kernel/VTManager/VirtualTerminal.class.cpp @@ -136,12 +136,13 @@ void VirtualTerminal::write(const String& s, bool updatecsr) { if (updatecsr) updateCursor(); } -void VirtualTerminal::writeDec(s32int i, bool updatecsr) { +void VirtualTerminal::writeDec(s64int num, bool updatecsr) { + u64int i = num; if (i == 0) { put('0', false); - } else if (i < 0) { + } else if (num < 0) { put('-', false); - i = 0 - i; + i = 0 - num; } char c[32]; int n = 0; diff --git a/Source/Kernel/VTManager/VirtualTerminal.class.h b/Source/Kernel/VTManager/VirtualTerminal.class.h index 6bdcf84..d8d7104 100644 --- a/Source/Kernel/VTManager/VirtualTerminal.class.h +++ b/Source/Kernel/VTManager/VirtualTerminal.class.h @@ -23,7 +23,7 @@ class VirtualTerminal { u32int m_csrlin, m_csrcol; - Mutex m_kbdMutex; + Mutex m_kbdMutex, m_kbdbuffMutex; Vector<Kbd::keypress_t> m_kbdbuff; //Key press events buffer public: @@ -47,7 +47,7 @@ class VirtualTerminal { //Display functions void put(WChar c, bool updatecsr = true); void write(const String& s, bool updatecsr = true); - void writeDec(s32int i, bool updatecsr = true); + void writeDec(s64int num, bool updatecsr = true); void writeHex(u32int i, bool updatecsr = true); void hexDump(u8int* ptr, u32int sz); @@ -55,6 +55,7 @@ class VirtualTerminal { inline VirtualTerminal& operator<<(const String& s) { write(s); return *this; } //inline VirtualTerminal& operator<<(WChar c) { put(c); return *this; } inline VirtualTerminal& operator<<(s32int i) { writeDec(i); return *this; } + inline VirtualTerminal& operator<<(s64int i) { writeDec(i); return *this; } inline VirtualTerminal& operator<<(u32int i) { writeHex(i); return *this; } //Keyboard functions |