mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
Catch anyone trying to use a DoubleBuffer with interrupts disabled.
This commit is contained in:
parent
09ba129bcf
commit
9c51d9dfcd
Notes:
sideshowbarker
2024-07-19 16:01:42 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/9c51d9dfcd9
1 changed files with 2 additions and 0 deletions
|
@ -19,6 +19,7 @@ void DoubleBuffer::flip()
|
|||
|
||||
ssize_t DoubleBuffer::write(const byte* data, size_t size)
|
||||
{
|
||||
ASSERT_INTERRUPTS_ENABLED();
|
||||
LOCKER(m_lock);
|
||||
m_write_buffer->append(data, size);
|
||||
compute_emptiness();
|
||||
|
@ -27,6 +28,7 @@ ssize_t DoubleBuffer::write(const byte* data, size_t size)
|
|||
|
||||
ssize_t DoubleBuffer::read(byte* data, size_t size)
|
||||
{
|
||||
ASSERT_INTERRUPTS_ENABLED();
|
||||
LOCKER(m_lock);
|
||||
if (m_read_buffer_index >= m_read_buffer->size() && !m_write_buffer->is_empty())
|
||||
flip();
|
||||
|
|
Loading…
Reference in a new issue