summaryrefslogtreecommitdiff
path: root/src/core/msgqueue.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/msgqueue.h')
-rw-r--r--src/core/msgqueue.h26
1 files changed, 4 insertions, 22 deletions
diff --git a/src/core/msgqueue.h b/src/core/msgqueue.h
index 93a26eb6..2d23f448 100644
--- a/src/core/msgqueue.h
+++ b/src/core/msgqueue.h
@@ -12,6 +12,7 @@
#define CORE_MSGQUEUE_H
#include "nng_impl.h"
+#include "pollable.h"
// Message queues. Message queues work in some ways like Go channels;
// they are a thread-safe way to pass messages between subsystems. They
@@ -77,28 +78,6 @@ typedef nni_msg *(*nni_msgq_filter)(void *, nni_msg *);
// discarded instead, and any get waiters remain waiting.
extern void nni_msgq_set_filter(nni_msgq *, nni_msgq_filter, void *);
-// nni_msgq_cb_flags is an enumeration of flag bits used with nni_msgq_cb.
-enum nni_msgq_cb_flags {
- nni_msgq_f_full = 1,
- nni_msgq_f_empty = 2,
- nni_msgq_f_can_get = 4,
- nni_msgq_f_can_put = 8,
- nni_msgq_f_closed = 16,
-};
-
-// nni_msgq_cb is a callback function used by sockets to monitor
-// the status of the queue. It is called with the lock held for
-// performance reasons so consumers must not re-enter the queue.
-// The purpose is to enable file descriptor notifications on the socket,
-// which don't need to reenter the msgq. The integer is a mask of
-// flags that are true for the given message queue.
-typedef void (*nni_msgq_cb)(void *, int);
-
-// nni_msgq_set_cb sets the callback and argument for the callback
-// which will be called on state changes in the message queue. Only
-// one callback can be registered on a message queue at a time.
-extern void nni_msgq_set_cb(nni_msgq *, nni_msgq_cb, void *);
-
// nni_msgq_close closes the queue. After this all operates on the
// message queue will return NNG_ECLOSED. Messages inside the queue
// are freed. Unlike closing a go channel, this operation is idempotent.
@@ -119,4 +98,7 @@ 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);
+extern int nni_msgq_get_recvable(nni_msgq *mq, nni_pollable **);
+extern int nni_msgq_get_sendable(nni_msgq *mq, nni_pollable **);
+
#endif // CORE_MSQUEUE_H