diff options
| author | Garrett D'Amore <garrett@damore.org> | 2016-12-12 21:29:52 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2016-12-12 21:29:52 -0800 |
| commit | 4919519754a0b5aee826add75273c291c33c4b5f (patch) | |
| tree | 10413c4f1768b47ca201a319bdcf13a9c5ac9473 /src/core/msgqueue.h | |
| parent | 1d1e8703b5735cd65fd3835573a6a66868adafa6 (diff) | |
| download | nng-4919519754a0b5aee826add75273c291c33c4b5f.tar.gz nng-4919519754a0b5aee826add75273c291c33c4b5f.tar.bz2 nng-4919519754a0b5aee826add75273c291c33c4b5f.zip | |
Make an interruptible version of message queues.
Diffstat (limited to 'src/core/msgqueue.h')
| -rw-r--r-- | src/core/msgqueue.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/msgqueue.h b/src/core/msgqueue.h index 9d856edd..85b22ece 100644 --- a/src/core/msgqueue.h +++ b/src/core/msgqueue.h @@ -64,6 +64,20 @@ extern int nni_msgqueue_put(nni_msgqueue_t, nng_msg_t, int); extern int nni_msgqueue_get(nni_msgqueue_t, nng_msg_t *, int); /* + * The following two functions are interruptible versions of msgqueue_get + * and msgqueue_put. The signal argument (pointer) must be initialized + * to zero. Then, we can raise a signal, by calling nni_msgqueue_signal + * on the same object. The signal flag will remain raised until it is + * cleared to zero. If a routine is interrupted, it will return NNG_EINTR. + * Note that only threads using the signal object will be interrupted; + * this has no effect on other threads that may be waiting on the msgqueue + * as well. + */ +extern int nni_msgqueue_put_sig(nni_msgqueue_t, nng_msg_t, int, int *); +extern int nni_msgqueue_get_sig(nni_msgqueue_t, nng_msg_t *, int, int *); +extern void nni_msgqueue_signal(nni_msgqueue_t, int *); + +/* * nni_msgqueue_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. |
