mq_close()

QNX SDP8.0C Library ReferenceAPIDeveloper

Close a message queue

Synopsis:

#include <mqueue.h>

int mq_close( mqd_t mqdes );

Arguments:

mqdes
The message-queue descriptor, returned by mq_open(), of the message queue that you want to close.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The mq_close() function removes the association between mqdes and a message queue. If the current process attaches a notify to this queue for notification, the attachment is eliminated. If this queue is unlinked before the call to mq_close(), and this process is the last process to call mq_close() on the queue, then the queue is destroyed, along with its contents.

Note:
The message queue manager needs to be running. For more information, see the entry for mqueue in the Utilities Reference.

In the traditional (mqueue) implementation, calling close() with mqdes has the same effect as calling mq_close().

Returns:

-1 if an error occurred (errno is set). Any other value indicates success.

Errors:

EBADF
Invalid queue mqdes.

Examples:

See the example for mq_open().

Classification:

POSIX 1003.1 MSG

Safety:
Cancellation pointNo
Signal handlerNo
ThreadYes
Page updated: