From 6237d268514e1f8aec562052954db22c4540eec3 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 25 Dec 2021 17:38:14 -0800 Subject: Provide a tiny buf for lmq buffer by default. This allows us to make nni_lmq_init() non-failing. (Although the buffer size requested at initialization might not be granted.) --- src/core/lmq.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/core/lmq.h') diff --git a/src/core/lmq.h b/src/core/lmq.h index 0a64c984..e38a7441 100644 --- a/src/core/lmq.h +++ b/src/core/lmq.h @@ -1,5 +1,5 @@ // -// Copyright 2019 Staysail Systems, Inc. +// Copyright 2021 Staysail Systems, Inc. // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -23,15 +23,16 @@ typedef struct nni_lmq { size_t lmq_get; size_t lmq_put; nng_msg **lmq_msgs; + nng_msg *lmq_buf[2]; // default minimal buffer } nni_lmq; -extern int nni_lmq_init(nni_lmq *, size_t); +extern void nni_lmq_init(nni_lmq *, size_t); extern void nni_lmq_fini(nni_lmq *); extern void nni_lmq_flush(nni_lmq *); extern size_t nni_lmq_len(nni_lmq *); extern size_t nni_lmq_cap(nni_lmq *); -extern int nni_lmq_putq(nni_lmq *, nng_msg *); -extern int nni_lmq_getq(nni_lmq *, nng_msg **); +extern int nni_lmq_put(nni_lmq *lmq, nng_msg *msg); +extern int nni_lmq_get(nni_lmq *lmq, nng_msg **mp); extern int nni_lmq_resize(nni_lmq *, size_t); extern bool nni_lmq_full(nni_lmq *); extern bool nni_lmq_empty(nni_lmq *); -- cgit v1.2.3-70-g09d2