mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 05:12:57 +01:00
core/cib: add peek capabilities
This commit is contained in:
parent
6d9c9279f0
commit
de173ff48f
@ -86,6 +86,22 @@ static inline int cib_get(cib_t *__restrict cib)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the index of the next item in buffer without removing it.
|
||||
*
|
||||
* @param[in,out] cib corresponding *cib* to buffer.
|
||||
* Must not be NULL.
|
||||
* @return index of next item, -1 if the buffer is empty
|
||||
*/
|
||||
static inline int cib_peek(cib_t *__restrict cib)
|
||||
{
|
||||
if (cib->write_count > cib->read_count) {
|
||||
return (int) (cib->read_count & cib->mask);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get index for item in buffer to put to.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user