30 lines
839 B
Markdown
Raw Permalink Normal View History

2017-04-22 17:16:38 +02:00
---
layout: pattern
title: Event Queue
folder: event-queue
permalink: /patterns/event-queue/
categories: Concurrency
language: en
2017-04-22 17:16:38 +02:00
tags:
- Game programming
2017-04-22 17:16:38 +02:00
---
## Intent
2017-08-31 01:50:33 +05:30
Event Queue is a good pattern if You have a limited accessibility resource (for example:
2017-04-22 17:16:38 +02:00
Audio or Database), but You need to handle all the requests that want to use that.
It puts all the requests in a queue and process them asynchronously.
Gives the resource for the event when it is the next in the queue and in same time
removes it from the queue.
## Class diagram
2017-04-22 17:16:38 +02:00
![alt text](./etc/model.png "Event Queue")
## Applicability
Use the Event Queue pattern when
2017-08-31 01:50:33 +05:30
* You have a limited accessibility resource and the asynchronous process is acceptable to reach that
2017-04-22 17:16:38 +02:00
## Credits
2017-05-15 10:40:12 +02:00
* [Mihaly Kuprivecz - Event Queue] (http://gameprogrammingpatterns.com/event-queue.html)