diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-11-09 23:45:21 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-11-11 11:03:12 -0800 |
| commit | 713b80f440cb414cd0b856bde0ea1b31f939777f (patch) | |
| tree | 1186c42418559c85719023bde3e919aa2df7fcef /src/platform/posix/posix_pollq_kqueue.c | |
| parent | cbe9a27ef7485977fbc7c713376b096b6723da3d (diff) | |
| download | nng-713b80f440cb414cd0b856bde0ea1b31f939777f.tar.gz nng-713b80f440cb414cd0b856bde0ea1b31f939777f.tar.bz2 nng-713b80f440cb414cd0b856bde0ea1b31f939777f.zip | |
refactor initialization/finalization
Applications must now call nng_init(), but they can supply
a set of parameters optionally. The code is now safe for
multiple libraries to do this concurrently, meaning nng_fini
no longer can race against another instance starting up.
The nni_init checks on all public APIs are removed now.
Diffstat (limited to 'src/platform/posix/posix_pollq_kqueue.c')
| -rw-r--r-- | src/platform/posix/posix_pollq_kqueue.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/platform/posix/posix_pollq_kqueue.c b/src/platform/posix/posix_pollq_kqueue.c index dda81be4..ae1b2f47 100644 --- a/src/platform/posix/posix_pollq_kqueue.c +++ b/src/platform/posix/posix_pollq_kqueue.c @@ -1,5 +1,5 @@ // -// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitar.com> // Copyright 2018 Liam Staskawicz <liam@stask.net> // @@ -9,6 +9,7 @@ // found online at https://opensource.org/licenses/MIT. // +#include "core/defs.h" #ifdef NNG_HAVE_KQUEUE #include <errno.h> @@ -41,7 +42,7 @@ struct nni_posix_pfd { nni_list_node node; // linkage into the reap list nni_posix_pollq *pq; // associated pollq int fd; // file descriptor to poll - void * arg; // user data + void *arg; // user data nni_posix_pfd_cb cb; // user callback on event bool closed; unsigned events; @@ -57,7 +58,7 @@ static nni_posix_pollq nni_posix_global_pollq; int nni_posix_pfd_init(nni_posix_pfd **pfdp, int fd) { - nni_posix_pfd * pf; + nni_posix_pfd *pf; nni_posix_pollq *pq; struct kevent ev[2]; unsigned flags = EV_ADD | EV_DISABLE | EV_CLEAR; @@ -234,9 +235,9 @@ nni_posix_poll_thr(void *arg) for (;;) { int n; struct kevent evs[NNI_MAX_KQUEUE_EVENTS]; - nni_posix_pfd * pf; + nni_posix_pfd *pf; nni_posix_pfd_cb cb; - void * cbarg; + void *cbarg; unsigned revents; nni_mtx_lock(&pq->mtx); @@ -335,8 +336,9 @@ nni_posix_pollq_create(nni_posix_pollq *pq) } int -nni_posix_pollq_sysinit(void) +nni_posix_pollq_sysinit(nng_init_params *params) { + NNI_ARG_UNUSED(params); return (nni_posix_pollq_create(&nni_posix_global_pollq)); } |
