Vystem 0.2
This commit is contained in:
23
docs/shelter/std/queues.md
Normal file
23
docs/shelter/std/queues.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Queues
|
||||
|
||||
## Introduction
|
||||
|
||||
The standard library provides various queues implementations for various objects sizes. Queue objects aren't thread safe. It is defined inside `shelter/lib/include/std/queue.h` and implemented in `shelter/lib/src/std/queue.c`.
|
||||
|
||||
## Keyboard events queue
|
||||
|
||||
This queue is represented by the following object:
|
||||
``` C
|
||||
typedef struct {
|
||||
sh_kbd_EVENT *buffer;
|
||||
sh_uint32 capacity;
|
||||
sh_uint32 write_index;
|
||||
} sh_queue_KBD_EVENT;
|
||||
```
|
||||
|
||||
These queues automatically overwrite the oldest object when the caller try to push an object when the queue is full.
|
||||
|
||||
The API is as follows:
|
||||
- `sh_queue_event_init(sh_queue_KBD_EVENT *q,sh_uint32 capacity)`: initialize a keyboard events queue, allocate the queue buffer
|
||||
- `sh_queue_event_push(sh_queue_KBD_EVENT *q,sh_kbd_EVENT ev)`: push an event into the provided queue
|
||||
- `sh_queue_event_destroy(sh_queue_KBD_EVENT *q)`: destroy the provided queue, free the queue buffer
|
||||
Reference in New Issue
Block a user