forked from Bananymous/banan-os
Kernel: Make Inodes use the new lock
Also remove old lock from TTY since it can just use the one Inode already has.
This commit is contained in:
parent
7c25e4ce5a
commit
12474addda
|
@ -121,9 +121,10 @@ namespace Kernel
|
||||||
virtual BAN::ErrorOr<void> chmod_impl(mode_t) { return BAN::Error::from_errno(ENOTSUP); }
|
virtual BAN::ErrorOr<void> chmod_impl(mode_t) { return BAN::Error::from_errno(ENOTSUP); }
|
||||||
virtual bool has_data_impl() const { dwarnln("nonblock not supported"); return true; }
|
virtual bool has_data_impl() const { dwarnln("nonblock not supported"); return true; }
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
mutable RecursiveSpinLock m_lock;
|
mutable RecursivePrioritySpinLock m_lock;
|
||||||
|
|
||||||
|
private:
|
||||||
BAN::WeakPtr<SharedFileData> m_shared_region;
|
BAN::WeakPtr<SharedFileData> m_shared_region;
|
||||||
friend class FileBackedRegion;
|
friend class FileBackedRegion;
|
||||||
};
|
};
|
||||||
|
|
|
@ -56,8 +56,6 @@ namespace Kernel
|
||||||
void do_backspace();
|
void do_backspace();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
mutable Kernel::RecursiveSpinLock m_lock;
|
|
||||||
|
|
||||||
TerminalDriver::Color m_foreground { TerminalColor::BRIGHT_WHITE };
|
TerminalDriver::Color m_foreground { TerminalColor::BRIGHT_WHITE };
|
||||||
TerminalDriver::Color m_background { TerminalColor::BLACK };
|
TerminalDriver::Color m_background { TerminalColor::BLACK };
|
||||||
termios m_termios;
|
termios m_termios;
|
||||||
|
|
|
@ -303,9 +303,13 @@ namespace Kernel
|
||||||
LockGuard _(m_lock);
|
LockGuard _(m_lock);
|
||||||
while (!m_output.flush)
|
while (!m_output.flush)
|
||||||
{
|
{
|
||||||
m_lock.unlock();
|
// FIXME: this is very hacky way to unlock lock temporarily
|
||||||
|
uint32_t depth = m_lock.lock_depth();
|
||||||
|
for (uint32_t i = 0; i < depth; i++)
|
||||||
|
m_lock.unlock();
|
||||||
bool eintr = Thread::current().block_or_eintr(m_output.semaphore);
|
bool eintr = Thread::current().block_or_eintr(m_output.semaphore);
|
||||||
m_lock.lock();
|
for (uint32_t i = 0; i < depth; i++)
|
||||||
|
m_lock.lock();
|
||||||
if (eintr)
|
if (eintr)
|
||||||
return BAN::Error::from_errno(EINTR);
|
return BAN::Error::from_errno(EINTR);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue