mq_close - close a message queue descriptor
mqd_t mq_close (mqd_t mqd<b>);
mq_close closes the connection between message queue descriptor, mqd, and
its associated queue. The descriptor, mqd, should have been obtained from
a prior call to mq_open(3c). No messages are added or removed from the
If multiple threads within a common process (i.e., sprocs, pthreads) are
sharing mqd, a single call to mq_close will close the message queue for
all threads within the calling process.
If the process has a notification request attached [see mq_notify(3c)] to
the queue, the notification request is removed and the queue is available
for attachment of a notification request.
If this is the last queue descriptor associated with the queue and the
queue has been unlinked [see mq_unlink(3c)] earlier, the message queue
will be removed.
mq_close will fail if one or more of the following conditions are true:
[EBADF] The message queue descriptor, mqd, is not valid.
[EINTR] A signal interrupted the mq_close function call.
mq_open(3c), open(3c), intro(3c), mq_unlink(3c), mq_receive(3c),
mq_send(3c), mq_getattr(3c), mq_setattr(3c), mq_notify(3c)
Upon successful completion, a value of 0 is returned. Otherwise, a value
of -1 is returned and errno is set to indicate the error.
PPPPaaaaggggeeee 1111 [ Back ]