View Code? Open in Web Editor
NEW
This project forked from wizard97/embedded_ringbuf_cpp
A simple C++ Ring (Circular) Buffer Queuing Library for Programming with Arduino's and other Embedded platforms
License: MIT License
embedded_ringbuf_cpp's People
embedded_ringbuf_cpp's Issues
|
/** |
|
* Remove last element from buffer, and copy it to dest |
|
* Return: true on success |
|
*/ |
|
bool pull(Type *dest) |
|
{ |
|
bool ret = false; |
|
size_t tail; |
|
|
|
RB_ATOMIC_START |
|
{ |
|
if (!isEmpty()) { |
|
tail = getTail(); |
|
*dest = _buf[tail]; |
|
_numElements--; |
|
|
|
ret = true; |
|
} |
|
} |
|
RB_ATOMIC_END |
|
|
|
return ret; |
|
} |
Should return a copy of the object instead of a pointer to it