---
name: "rt_mq_destroy"
section: "2"
platform: "linux"
package: "rtlinux"
version: "2.0rel-1"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/rt_mq_destroy"
---

# rt\_mq\_destroy(2)

remove a message queue

## NAME

rt\_mq\_destroy - remove a message queue

## SYNOPSIS

```
#define MODULE
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/errno.h>
#include rt_ipc.h
```

**int rt\_mq\_destroy(rt\_sem\_t \****sem***);**

## DESCRIPTION

**rt\_mq\_destroy** removes a message queue previously created with **rt\_mq\_create**. *mq* points to the structure used in the corresponding call to **rt\_mq\_create**. Message queue deletion safety is implemented; i.e., any tasks blocked on this  message queue when it is destroyed are allowed to run.

## RETURN VALUE

On success, 0 is returned.  On failure, a negative value is returned as described below.

## ERRORS

- **-EINVAL**

  *sem* does not point to a valid rt\_mq\_t.

## AUTHOR

Jerry Epplin \<JerryEpplin@worldnet.att.net\>

## SEE ALSO

[**rt\_mq\_init**(2)](/rt_mq_init/2.md), [**rt\_mq\_receive**(2)](/rt_mq_receive/2.md), [**rt\_mq\_send**(2)](/rt_mq_send/2.md), [**rt\_task\_ipc\_delete**(2)](/rt_task_ipc_delete/2.md), [**rt\_task\_ipc\_init**(2)](/rt_task_ipc_init/2.md)
