Skip to content

Commit

Permalink
Actually implement the try_put_copy() ringbuffer method
Browse files Browse the repository at this point in the history
  • Loading branch information
lpereira committed May 26, 2024
1 parent 575d56b commit ff5bd0b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib/ringbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@
rb->array[type_name_##_mask(rb->write++)] = e; \
} \
\
__attribute__((unused)) static inline bool type_name_##_try_put_copy( \
struct type_name_ *rb, element_type_ e) \
{ \
if (type_name_##_full(rb)) \
return false; \
\
rb->array[type_name_##_mask(rb->write++)] = e; \
} \
\
__attribute__((unused)) static inline bool type_name_##_try_put( \
struct type_name_ *rb, const element_type_ *e) \
{ \
Expand Down

0 comments on commit ff5bd0b

Please sign in to comment.