diff options
author | Marti Bolivar <mbolivar@leaflabs.com> | 2011-04-04 13:40:25 -0400 |
---|---|---|
committer | Marti Bolivar <mbolivar@leaflabs.com> | 2011-04-05 13:21:06 -0400 |
commit | fb5a1612bcadf14460a88de08a065f4a5229f02f (patch) | |
tree | 104bf13bfd2004ce77bad21a3873f5431d74b772 /libmaple | |
parent | 83e240f25035e34e4a43273122cb17d3f4725dac (diff) | |
download | librambutan-fb5a1612bcadf14460a88de08a065f4a5229f02f.tar.gz librambutan-fb5a1612bcadf14460a88de08a065f4a5229f02f.zip |
ring_buffer tweaks.
Adding basic ring_buffer test (cherry-pick from master).
Changing rb_safe_insert()'s type to match that of rb_push_insert().
(Makes it easier to pass around insertion functions.)
Diffstat (limited to 'libmaple')
-rw-r--r-- | libmaple/ring_buffer.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libmaple/ring_buffer.h b/libmaple/ring_buffer.h index eadb292..9f35d3d 100644 --- a/libmaple/ring_buffer.h +++ b/libmaple/ring_buffer.h @@ -118,8 +118,12 @@ static inline int16 rb_safe_remove(ring_buffer *rb) { } /** - * If rb is not full, appends element and returns true; otherwise, - * does nothing and returns false. */ + * @brief Attempt to insert an element into a ring buffer. + * + * @brief rb Buffer to insert into. + * @brief element Value to insert into rb. + * @sideeffect If rb is not full, appends element onto buffer. + * @return If element was appended, then true; otherwise, false. */ static inline int rb_safe_insert(ring_buffer *rb, uint8 element) { if (rb_is_full(rb)) { return 0; |