summaryrefslogtreecommitdiff
path: root/src/core/msgqueue.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-16 19:35:51 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-16 19:35:51 -0800
commit50e1484af0d443b46aa04fd4a8096b157dc160aa (patch)
treeab517217c82e785b0c851c986ee44dfc4a4a65fe /src/core/msgqueue.h
parentac8415c24ffea645105c3859e814843e81c97f8a (diff)
downloadnng-50e1484af0d443b46aa04fd4a8096b157dc160aa.tar.gz
nng-50e1484af0d443b46aa04fd4a8096b157dc160aa.tar.bz2
nng-50e1484af0d443b46aa04fd4a8096b157dc160aa.zip
Recv/Send event plumbing implemented (msgqueue and up).
This change provides for a private callback in the message queues, which can be used to notify the socket, and which than arranges for the appropriate event thread to run. Upper layer hooks to access this still need to be written.
Diffstat (limited to 'src/core/msgqueue.h')
-rw-r--r--src/core/msgqueue.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/msgqueue.h b/src/core/msgqueue.h
index 450c55a4..07f6aebb 100644
--- a/src/core/msgqueue.h
+++ b/src/core/msgqueue.h
@@ -131,4 +131,15 @@ extern int nni_msgq_cap(nni_msgq *mq);
// nni_msgq_len returns the number of messages currently in the queue.
extern int nni_msgq_len(nni_msgq *mq);
+#define NNI_MSGQ_NOTIFY_CANPUT 1
+#define NNI_MSGQ_NOTIFY_CANGET 2
+
+typedef void (*nni_msgq_notify_fn)(nni_msgq *, int, void *);
+
+// nni_msgq_notify registers a function to be called when the message
+// queue state changes. It notifies that the queue is readable, or writeable.
+// Only one function can be registered (for simplicity), and it is called
+// outside of the queue's lock.
+extern void nni_msgq_notify(nni_msgq *, nni_msgq_notify_fn, void *);
+
#endif // CORE_MSQUEUE_H