This commit is contained in:
Ilkka Seppälä
2019-12-13 21:09:28 +02:00
parent 0335c61512
commit b2b1ba95eb
127 changed files with 282 additions and 450 deletions

View File

@ -3,10 +3,10 @@ layout: pattern
title: Double Buffer
folder: double-buffer
permalink: /patterns/double-buffer/
categories: Other
categories: Behavioral
tags:
- Java
- Difficulty-Beginner
- Performance
- Game programming
---
## Intent
@ -19,11 +19,8 @@ Double buffering is a term used to describe a device that has two buffers. The u
This pattern is one of those ones where youll know when you need it. If you have a system that lacks double buffering, it will probably look visibly wrong (tearing, etc.) or will behave incorrectly. But saying, “youll know when you need it” doesnt give you much to go on. More specifically, this pattern is appropriate when all of these are true:
- We have some state that is being modified incrementally.
- That same state may be accessed in the middle of modification.
- We want to prevent the code thats accessing the state from seeing the work in progress.
- We want to be able to read the state and we dont want to have to wait while its being written.
## Credits