close a message queue
#include <mqueue.h> int mq_close( mqd_t mqdes );
The mq_close() function removes the association between the message-queue descriptor mqdes and a message queue. If the current process has attached a signal to this queue for notification, this attachment is eliminated.
If this queue has been unlinked before the call to mq_close(), and this process is the last process to call mq_close() on the queue, then the queue, along with its contents, is destroyed.
Calling close() with a file descriptor that represents a message queue has the same effect as calling mq_close().
0 if the message queue is successfully closed, otherwise -1, and errno is set.
POSIX 1003.4
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | Yes, but modifies errno |
Thread | Yes |
In order to use the mq_... functions, you must:
close(), errno, mq_getattr(), mq_notify(), mq_open(), mq_receive(), mq_send(), mq_setattr(), mq_unlink()
chapter on POSIX.4 message queues