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:
parent
2e2d883c09
commit
3ac977f50b
4 changed files with 20 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue