The
mq_unlink() function removes the message queue named by the pathname
name. After a successful call to
mq_unlink() with
name, a call to
mq_open(3) with
name fails if the flag
O_CREAT is not set in
flags. If one or more processes have the message queue open when
mq_unlink() is called, destruction of the message queue will be postponed until all references to the message queue have been closed.
Calls to
mq_open(3) to recreate the message queue may fail until the message queue is actually removed. However, the
mq_unlink() call need not block until all references have been closed; it may return immediately.