diff options
| author | Garrett D'Amore <garrett@damore.org> | 2021-12-25 17:38:14 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2021-12-25 17:38:14 -0800 |
| commit | 6237d268514e1f8aec562052954db22c4540eec3 (patch) | |
| tree | 32213ea0016ae10faee2817f414308c91d881c42 /src/core/lmq.h | |
| parent | 7a54bcd6fe345f35dd51eede6c5d66e8516c16ab (diff) | |
| download | nng-6237d268514e1f8aec562052954db22c4540eec3.tar.gz nng-6237d268514e1f8aec562052954db22c4540eec3.tar.bz2 nng-6237d268514e1f8aec562052954db22c4540eec3.zip | |
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.)
Diffstat (limited to 'src/core/lmq.h')
| -rw-r--r-- | src/core/lmq.h | 9 |
1 files changed, 5 insertions, 4 deletions
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. <info@staysail.tech> +// Copyright 2021 Staysail Systems, Inc. <info@staysail.tech> // // 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 *); |
