#include <shbuf.h>
Data Fields | |
| unsigned long | read_idx |
| Where to read the next bytes from. | |
| unsigned long | length |
| Amount of bytes currently in the buffer. | |
| unsigned long | backlog |
| Length of current backlog in bytes. | |
| unsigned long | backlog_target |
| Try to keep so many bytes as backlog. | |
| unsigned long | write_count |
| Simple counter, incremented on every write. | |
| unsigned long | read_count |
| Simple counter, incremented on every read. | |
| int | ignore_read_inc |
Boolean; when this flag is set, the next call to shbuf_inc_read_pointer() will be ignored and this flag will be disabled again. | |
| int | ignore_write_inc |
| Corresponding here. | |
It contains some indexes which specify the current fill level of the buffer.
Typical buffer layout:
<---backlog--> <---length---->
+----------------+--------------+---------------+------------------+
| | | | |
| | BACKLOG | DATA | |
| | | | |
+----------------+--------------+---------------+------------------+
^ ^ ^ ^ ^
0 | read_idx | size
read_idx-backlog |
read_idx+length
Note: In reality it is not so simple as it looks in this graphic, since you always need to think about buffer wrap arounds.
Definition at line 235 of file shbuf.h.
|
|
Length of current backlog in bytes.
|
|
|
Try to keep so many bytes as backlog.
|
|
|
Boolean; when this flag is set, the next call to
|
|
|
Corresponding here.
|
|
|
Amount of bytes currently in the buffer.
|
|
|
Simple counter, incremented on every read.
|
|
|
Where to read the next bytes from.
|
|
|
Simple counter, incremented on every write.
|
1.2.18