aboutsummaryrefslogtreecommitdiff
path: root/include/salticidae/buffer.h
diff options
context:
space:
mode:
authorDeterminant <ted.sybil@gmail.com>2019-04-03 14:55:26 -0400
committerDeterminant <ted.sybil@gmail.com>2019-04-03 14:55:26 -0400
commitb7802b3b06511f067719cb845dfd03a223f0e18f (patch)
tree80bd89e89e073e0a51233a228a562c463f8a20d4 /include/salticidae/buffer.h
parentaaa5ab0a55c0b9758e59883dcffae248c6c52564 (diff)
improve non-blocking API
Diffstat (limited to 'include/salticidae/buffer.h')
-rw-r--r--include/salticidae/buffer.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/salticidae/buffer.h b/include/salticidae/buffer.h
index 2324d8b..c7b11dd 100644
--- a/include/salticidae/buffer.h
+++ b/include/salticidae/buffer.h
@@ -126,14 +126,14 @@ struct MPSCWriteBuffer {
MPSCWriteBuffer(const SegBuffer &other) = delete;
MPSCWriteBuffer(SegBuffer &&other) = delete;
+ void set_capacity(size_t capacity) { buffer.set_capacity(capacity); }
+
void rewind(bytearray_t &&data) {
buffer.rewind(buffer_entry_t(std::move(data)));
}
- void push(bytearray_t &&data) {
- buffer_entry_t d(std::move(data));
- // TODO: better bounded buffer impl
- while (!buffer.try_enqueue(d)) {}
+ bool push(bytearray_t &&data, bool unbounded) {
+ return buffer.enqueue(buffer_entry_t(std::move(data)), unbounded);
}
bytearray_t move_pop() {