Skip to content

Commit ff5bd0b

Browse files
committed
Actually implement the try_put_copy() ringbuffer method
1 parent 575d56b commit ff5bd0b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/lib/ringbuffer.h

+9
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@
8383
rb->array[type_name_##_mask(rb->write++)] = e; \
8484
} \
8585
\
86+
__attribute__((unused)) static inline bool type_name_##_try_put_copy( \
87+
struct type_name_ *rb, element_type_ e) \
88+
{ \
89+
if (type_name_##_full(rb)) \
90+
return false; \
91+
\
92+
rb->array[type_name_##_mask(rb->write++)] = e; \
93+
} \
94+
\
8695
__attribute__((unused)) static inline bool type_name_##_try_put( \
8796
struct type_name_ *rb, const element_type_ *e) \
8897
{ \

0 commit comments

Comments
 (0)