diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-12-19 07:14:39 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-12-19 07:17:57 -0800 |
| commit | 5e18eb4f18af570abf84a615db5235e2e9415c75 (patch) | |
| tree | ec1c8a7a58fed101f1f61651a5f319c64cfec329 /src/platform/posix/posix_pollq_kqueue.c | |
| parent | 0d39d4be2d4b53e8ede04364f082b3ba295979f2 (diff) | |
| download | nng-5e18eb4f18af570abf84a615db5235e2e9415c75.tar.gz nng-5e18eb4f18af570abf84a615db5235e2e9415c75.tar.bz2 nng-5e18eb4f18af570abf84a615db5235e2e9415c75.zip | |
posix pollers: expose pfd structures (for sizes) and fix poller selection
The poller selection in the previous poller changes for select were
not quite functional. Also, while testing poll() based poller, there
were problems where it simply did not work correctly, so this addresses
those, and it seems to work now.
The pfd structures are exposed as we intend to allow inlining them
to eliminate the separate allocation and potential for failure during
initialization. We also want to have plans afoot to eliminate a
lot of the extra locking done done on each I/O iteration, and this
is setting the foundation for that.
Diffstat (limited to 'src/platform/posix/posix_pollq_kqueue.c')
| -rw-r--r-- | src/platform/posix/posix_pollq_kqueue.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/platform/posix/posix_pollq_kqueue.c b/src/platform/posix/posix_pollq_kqueue.c index e78b89a8..e3727ed3 100644 --- a/src/platform/posix/posix_pollq_kqueue.c +++ b/src/platform/posix/posix_pollq_kqueue.c @@ -9,7 +9,6 @@ // found online at https://opensource.org/licenses/MIT. // -#include "core/defs.h" #ifdef NNG_HAVE_KQUEUE #include <errno.h> @@ -24,11 +23,9 @@ #include "core/nng_impl.h" #include "platform/posix/posix_pollq.h" -typedef struct nni_posix_pollq nni_posix_pollq; - // nni_posix_pollq is a work structure that manages state for the kqueue-based // pollq implementation -struct nni_posix_pollq { +typedef struct nni_posix_pollq { nni_mtx mtx; int wake_wfd; // write side of wake pipe int wake_rfd; // read side of wake pipe @@ -36,19 +33,7 @@ struct nni_posix_pollq { int kq; // kqueue handle nni_thr thr; // worker thread nni_list reapq; // items to reap -}; - -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 - nni_posix_pfd_cb cb; // user callback on event - bool closed; - unsigned events; - nni_cv cv; // signaled when poller has unregistered - nni_mtx mtx; -}; +} nni_posix_pollq; #define NNI_MAX_KQUEUE_EVENTS 64 |
