1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 22:42:08 +00:00

Paper over a race in DoubleBuffer.

I'm still somewhat okay throwing InterruptDisabler at races as they screw me.
Eventually I'm gonna have to devise a different strategy though.
This commit is contained in:
Andreas Kling 2019-01-12 23:23:35 +01:00
parent 2e2d883c09
commit 3ac977f50b
4 changed files with 20 additions and 4 deletions

View file

@ -2,9 +2,13 @@
void DoubleBuffer::flip()
{
InterruptDisabler disabler;
ASSERT(m_read_buffer_index == m_read_buffer->size());
swap(m_read_buffer, m_write_buffer);
m_write_buffer->clear();
if (m_write_buffer->capacity() < 32)
m_write_buffer->clear_with_capacity();
else
m_write_buffer->clear();
m_read_buffer_index = 0;
}