aboutsummaryrefslogtreecommitdiff
path: root/src/platform/posix/posix_pollq_port.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/platform/posix/posix_pollq_port.h')
-rw-r--r--src/platform/posix/posix_pollq_port.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/platform/posix/posix_pollq_port.h b/src/platform/posix/posix_pollq_port.h
new file mode 100644
index 00000000..cbeab694
--- /dev/null
+++ b/src/platform/posix/posix_pollq_port.h
@@ -0,0 +1,38 @@
+//
+// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2018 Capitar IT Group BV <info@capitar.com>
+//
+// This software is supplied under the terms of the MIT License, a
+// copy of which should be located in the distribution where this
+// file was obtained (LICENSE.txt). A copy of the license may also be
+// found online at https://opensource.org/licenses/MIT.
+//
+
+#ifndef PLATFORM_POSIX_POLLQ_PORT_H
+#define PLATFORM_POSIX_POLLQ_PORT_H
+
+#include <poll.h>
+
+typedef struct nni_posix_pollq nni_posix_pollq;
+
+// nni_posix_pfd is the handle used by the poller. It's internals are private
+// to the poller.
+struct nni_posix_pfd {
+ nni_posix_pollq *pq;
+ int fd;
+ nni_mtx mtx;
+ nni_cv cv;
+ unsigned events;
+ bool closed;
+ bool closing;
+ nni_posix_pfd_cb cb;
+ void *data;
+};
+
+#define NNI_POLL_IN ((unsigned) POLLIN)
+#define NNI_POLL_OUT ((unsigned) POLLOUT)
+#define NNI_POLL_HUP ((unsigned) POLLHUP)
+#define NNI_POLL_ERR ((unsigned) POLLERR)
+#define NNI_POLL_INVAL ((unsigned) POLLNVAL)
+
+#endif // PLATFORM_POSIX_POLLQ_PORT_H