Lines Matching full:message
3 Message Queues
6 A :dfn:`message queue` is a kernel object that implements a simple
7 message queue, allowing threads and ISRs to asynchronously send and receive
17 Any number of message queues can be defined (limited only by available RAM).
18 Each message queue is referenced by its memory address.
20 A message queue has the following key properties:
28 A message queue must be initialized before it can be used.
31 A data item can be **sent** to a message queue by a thread or an ISR.
33 if one exists; otherwise the item is copied to the message queue's ring buffer,
35 *must* equal the message queue's data item size.
43 A data item can be **received** from a message queue by a thread.
45 the size of the receiving area *must* equal the message queue's data item size.
53 A thread can also **peek** at the message on the head of a message queue without
56 the size of the receiving area *must* equal the message queue's data item size.
59 The kernel does allow an ISR to receive an item from a message queue,
60 however the ISR must not attempt to wait if the message queue is empty.
63 Alignment of the message queue's ring buffer is not necessary.
70 Defining a Message Queue
73 A message queue is defined using a variable of type :c:struct:`k_msgq`.
76 The following code defines and initializes an empty message queue
92 Alternatively, a message queue can be defined and initialized at compile time
96 that the macro defines both the message queue and its buffer.
102 Writing to a Message Queue
105 A data item is added to a message queue by calling :c:func:`k_msgq_put`.
107 The following code builds on the example above, and uses the message queue
109 If the message queue fills up because the consumers can't keep up, the
125 /* message queue is full: purge old data & try again */
129 /* data item was successfully added to message queue */
133 Reading from a Message Queue
136 A data item is taken from a message queue by calling :c:func:`k_msgq_get`.
138 The following code builds on the example above, and uses the message queue
159 Peeking into a Message Queue
162 A data item is read from a message queue by calling :c:func:`k_msgq_peek`.
164 The following code peeks into the message queue to read the data item at the
185 Use a message queue to transfer small data items between threads
189 A message queue can be used to transfer large data items, if desired.