Skip to main content
Renesas Electronics Europe - Knowledgebase

Using Message Queues

Latest Updated:10/04/2016

What are message queues?

Message queues are the primary means of interthread communication in ThreadX. One or more messages can reside in a message queue.

Does ThreadX support the mailbox abstraction?

A message queue that holds a single message is commonly called a mailbox.

How do message queues work?

Messages are copied to a queue by tx_queue_send and are copied from a queue by tx_queue_receive. The only exception to this is when a thread is suspended while waiting for a message on an empty queue. In this case, the next message sent to the queue is placed directly into the thread’s destination area.

How are message queues created?

Message queues are created either during initialization or during run-time by application threads. There is no limit on the number of message queues in an application.

What message sizes are supported?

Each message queue supports a number of fixed sized messages. The available message sizes are 1 through 16 32-bit words inclusive. The message size is specified when the queue is created. Application messages greater than 16 words must be passed by pointer. This is accomplished by creating a queue with a message size of 1 word (enough to hold a pointer) and then sending and receiving message pointers instead of the entire message.

What is the message queue capacity?

The number of messages a queue can hold is a function of its message size and the size of the memory area supplied during creation. The total message capacity of the queue is calculated by dividing the number of bytes in each message into the total number of bytes in the supplied memory area.
For example, if a message queue that supports a message size of 1 32-bit word (4 bytes) is created with a 100-byte memory area, its capacity is 25 messages.

Where can I find more information?

You can find more information on the ThreadX user manual, available here


©1997-2015 by Express Logic, Inc. All rights reserved. This document and the associated ThreadX software are the sole property of Express Logic, Inc. Each contains proprietary information of Express Logic, Inc.

  • Was this article helpful?