source: rtems-docs/c-user/message_manager.rst @ e52906b

5
Last change on this file since e52906b was e52906b, checked in by Sebastian Huber <sebastian.huber@…>, on 01/09/19 at 15:14:06

Simplify SPDX-License-Identifier comment

  • Property mode set to 100644
File size: 26.3 KB
Line 
1.. SPDX-License-Identifier: CC-BY-SA-4.0
2
3.. Copyright (C) 1988, 2008 On-Line Applications Research Corporation (OAR)
4
5.. index:: messages
6.. index:: message queues
7
8Message Manager
9***************
10
11Introduction
12============
13
14The message manager provides communication and synchronization capabilities
15using RTEMS message queues.  The directives provided by the message manager
16are:
17
18- rtems_message_queue_create_ - Create a queue
19
20- rtems_message_queue_ident_ - Get ID of a queue
21
22- rtems_message_queue_delete_ - Delete a queue
23
24- rtems_message_queue_send_ - Put message at rear of a queue
25
26- rtems_message_queue_urgent_ - Put message at front of a queue
27
28- rtems_message_queue_broadcast_ - Broadcast N messages to a queue
29
30- rtems_message_queue_receive_ - Receive message from a queue
31
32- rtems_message_queue_get_number_pending_ - Get number of messages pending on a queue
33
34- rtems_message_queue_flush_ - Flush all messages on a queue
35
36Background
37==========
38
39Messages
40--------
41
42A message is a variable length buffer where information can be stored to
43support communication.  The length of the message and the information stored in
44that message are user-defined and can be actual data, pointer(s), or empty.
45
46Message Queues
47--------------
48
49A message queue permits the passing of messages among tasks and ISRs.  Message
50queues can contain a variable number of messages.  Normally messages are sent
51to and received from the queue in FIFO order using the
52``rtems_message_queue_send`` directive.  However, the
53``rtems_message_queue_urgent`` directive can be used to place messages at the
54head of a queue in LIFO order.
55
56Synchronization can be accomplished when a task can wait for a message to
57arrive at a queue.  Also, a task may poll a queue for the arrival of a message.
58
59The maximum length message which can be sent is set on a per message queue
60basis.  The message content must be copied in general to/from an internal
61buffer of the message queue or directly to a peer in certain cases.  This copy
62operation is performed with interrupts disabled.  So it is advisable to keep
63the messages as short as possible.
64
65.. index:: message queue attributes
66
67Building a Message Queue Attribute Set
68--------------------------------------
69
70In general, an attribute set is built by a bitwise OR of the desired attribute
71components.  The set of valid message queue attributes is provided in the
72following table:
73
74.. list-table::
75 :class: rtems-table
76
77 * - ``RTEMS_FIFO``
78   - tasks wait by FIFO (default)
79 * - ``RTEMS_PRIORITY``
80   - tasks wait by priority
81 * - ``RTEMS_LOCAL``
82   - local message queue (default)
83 * - ``RTEMS_GLOBAL``
84   - global message queue
85
86An attribute listed as a default is not required to appear in the attribute
87list, although it is a good programming practice to specify default attributes.
88If all defaults are desired, the attribute ``RTEMS_DEFAULT_ATTRIBUTES`` should
89be specified on this call.
90
91This example demonstrates the attribute_set parameter needed to create a local
92message queue with the task priority waiting queue discipline.  The
93attribute_set parameter to the ``rtems_message_queue_create`` directive could
94be either ``RTEMS_PRIORITY`` or ``RTEMS_LOCAL | RTEMS_PRIORITY``.  The
95attribute_set parameter can be set to ``RTEMS_PRIORITY`` because
96``RTEMS_LOCAL`` is the default for all created message queues.  If a similar
97message queue were to be known globally, then the attribute_set parameter would
98be ``RTEMS_GLOBAL | RTEMS_PRIORITY``.
99
100Building a MESSAGE_QUEUE_RECEIVE Option Set
101-------------------------------------------
102
103In general, an option is built by a bitwise OR of the desired option
104components.  The set of valid options for the ``rtems_message_queue_receive``
105directive are listed in the following table:
106
107.. list-table::
108 :class: rtems-table
109
110 * - ``RTEMS_WAIT``
111   - task will wait for a message (default)
112 * - ``RTEMS_NO_WAIT``
113   - task should not wait
114
115An option listed as a default is not required to appear in the option OR list,
116although it is a good programming practice to specify default options.  If all
117defaults are desired, the option ``RTEMS_DEFAULT_OPTIONS`` should be specified
118on this call.
119
120This example demonstrates the option parameter needed to poll for a message to
121arrive.  The option parameter passed to the ``rtems_message_queue_receive``
122directive should be ``RTEMS_NO_WAIT``.
123
124Operations
125==========
126
127Creating a Message Queue
128------------------------
129
130The ``rtems_message_queue_create`` directive creates a message queue with the
131user-defined name.  The user specifies the maximum message size and maximum
132number of messages which can be placed in the message queue at one time.  The
133user may select FIFO or task priority as the method for placing waiting tasks
134in the task wait queue.  RTEMS allocates a Queue Control Block (QCB) from the
135QCB free list to maintain the newly created queue as well as memory for the
136message buffer pool associated with this message queue.  RTEMS also generates a
137message queue ID which is returned to the calling task.
138
139For GLOBAL message queues, the maximum message size is effectively limited to
140the longest message which the MPCI is capable of transmitting.
141
142Obtaining Message Queue IDs
143---------------------------
144
145When a message queue is created, RTEMS generates a unique message queue ID.
146The message queue ID may be obtained by either of two methods.  First, as the
147result of an invocation of the ``rtems_message_queue_create`` directive, the
148queue ID is stored in a user provided location.  Second, the queue ID may be
149obtained later using the ``rtems_message_queue_ident`` directive.  The queue ID
150is used by other message manager directives to access this message queue.
151
152Receiving a Message
153-------------------
154
155The ``rtems_message_queue_receive`` directive attempts to retrieve a message
156from the specified message queue.  If at least one message is in the queue,
157then the message is removed from the queue, copied to the caller's message
158buffer, and returned immediately along with the length of the message.  When
159messages are unavailable, one of the following situations applies:
160
161- By default, the calling task will wait forever for the message to arrive.
162
163- Specifying the ``RTEMS_NO_WAIT`` option forces an immediate return with an
164  error status code.
165
166- Specifying a timeout limits the period the task will wait before returning
167  with an error status.
168
169If the task waits for a message, then it is placed in the message queue's task
170wait queue in either FIFO or task priority order.  All tasks waiting on a
171message queue are returned an error code when the message queue is deleted.
172
173Sending a Message
174-----------------
175
176Messages can be sent to a queue with the ``rtems_message_queue_send`` and
177``rtems_message_queue_urgent`` directives.  These directives work identically
178when tasks are waiting to receive a message.  A task is removed from the task
179waiting queue, unblocked, and the message is copied to a waiting task's message
180buffer.
181
182When no tasks are waiting at the queue, ``rtems_message_queue_send`` places the
183message at the rear of the message queue, while ``rtems_message_queue_urgent``
184places the message at the front of the queue.  The message is copied to a
185message buffer from this message queue's buffer pool and then placed in the
186message queue.  Neither directive can successfully send a message to a message
187queue which has a full queue of pending messages.
188
189Broadcasting a Message
190----------------------
191
192The ``rtems_message_queue_broadcast`` directive sends the same message to every
193task waiting on the specified message queue as an atomic operation.  The
194message is copied to each waiting task's message buffer and each task is
195unblocked.  The number of tasks which were unblocked is returned to the caller.
196
197Deleting a Message Queue
198------------------------
199
200The ``rtems_message_queue_delete`` directive removes a message queue from the
201system and frees its control block as well as the memory associated with this
202message queue's message buffer pool.  A message queue can be deleted by any
203local task that knows the message queue's ID.  As a result of this directive,
204all tasks blocked waiting to receive a message from the message queue will be
205readied and returned a status code which indicates that the message queue was
206deleted.  Any subsequent references to the message queue's name and ID are
207invalid.  Any messages waiting at the message queue are also deleted and
208deallocated.
209
210Directives
211==========
212
213This section details the message manager's directives.  A subsection is
214dedicated to each of this manager's directives and describes the calling
215sequence, related constants, usage, and status codes.
216
217.. raw:: latex
218
219   \clearpage
220
221.. index:: create a message queue
222.. index:: rtems_message_queue_create
223
224.. _rtems_message_queue_create:
225
226MESSAGE_QUEUE_CREATE - Create a queue
227-------------------------------------
228
229CALLING SEQUENCE:
230    .. code-block:: c
231
232        rtems_status_code rtems_message_queue_create(
233            rtems_name        name,
234            uint32_t          count,
235            size_t            max_message_size,
236            rtems_attribute   attribute_set,
237            rtems_id         *id
238        );
239
240DIRECTIVE STATUS CODES:
241    .. list-table::
242     :class: rtems-table
243
244     * - ``RTEMS_SUCCESSFUL``
245       - queue created successfully
246     * - ``RTEMS_INVALID_NAME``
247       - invalid queue name
248     * - ``RTEMS_INVALID_ADDRESS``
249       - ``id`` is NULL
250     * - ``RTEMS_INVALID_NUMBER``
251       - invalid message count
252     * - ``RTEMS_INVALID_SIZE``
253       - invalid message size
254     * - ``RTEMS_TOO_MANY``
255       - too many queues created
256     * - ``RTEMS_UNSATISFIED``
257       - unable to allocate message buffers
258     * - ``RTEMS_MP_NOT_CONFIGURED``
259       - multiprocessing not configured
260     * - ``RTEMS_TOO_MANY``
261       - too many global objects
262
263DESCRIPTION:
264    This directive creates a message queue which resides on the local node with
265    the user-defined name specified in name.  For control and maintenance of
266    the queue, RTEMS allocates and initializes a QCB.  Memory is allocated from
267    the RTEMS Workspace for the specified count of messages, each of
268    max_message_size bytes in length.  The RTEMS-assigned queue id, returned in
269    id, is used to access the message queue.
270
271    Specifying ``RTEMS_PRIORITY`` in attribute_set causes tasks waiting for a
272    message to be serviced according to task priority.  When ``RTEMS_FIFO`` is
273    specified, waiting tasks are serviced in First In-First Out order.
274
275NOTES:
276    This directive will not cause the calling task to be preempted.
277
278    The following message queue attribute constants are defined by RTEMS:
279
280    .. list-table::
281     :class: rtems-table
282
283     * - ``RTEMS_FIFO``
284       - tasks wait by FIFO (default)
285     * - ``RTEMS_PRIORITY``
286       - tasks wait by priority
287     * - ``RTEMS_LOCAL``
288       - local message queue (default)
289     * - ``RTEMS_GLOBAL``
290       - global message queue
291
292    Message queues should not be made global unless remote tasks must interact
293    with the created message queue.  This is to avoid the system overhead
294    incurred by the creation of a global message queue.  When a global message
295    queue is created, the message queue's name and id must be transmitted to
296    every node in the system for insertion in the local copy of the global
297    object table.
298
299    For GLOBAL message queues, the maximum message size is effectively limited
300    to the longest message which the MPCI is capable of transmitting.
301
302    The total number of global objects, including message queues, is limited by
303    the ``maximum_global_objects`` field in the configuration table.
304
305.. raw:: latex
306
307   \clearpage
308
309.. index:: get ID of a message queue
310.. index:: rtems_message_queue_ident
311
312.. _rtems_message_queue_ident:
313
314MESSAGE_QUEUE_IDENT - Get ID of a queue
315---------------------------------------
316
317CALLING SEQUENCE:
318    .. code-block:: c
319
320        rtems_status_code rtems_message_queue_ident(
321            rtems_name  name,
322            uint32_t    node,
323            rtems_id   *id
324        );
325
326DIRECTIVE STATUS CODES:
327    .. list-table::
328     :class: rtems-table
329
330     * - ``RTEMS_SUCCESSFUL``
331       - queue identified successfully
332     * - ``RTEMS_INVALID_ADDRESS``
333       - ``id`` is NULL
334     * - ``RTEMS_INVALID_NAME``
335       - queue name not found
336     * - ``RTEMS_INVALID_NODE``
337       - invalid node id
338
339DESCRIPTION:
340    This directive obtains the queue id associated with the queue name
341    specified in name.  If the queue name is not unique, then the queue id will
342    match one of the queues with that name.  However, this queue id is not
343    guaranteed to correspond to the desired queue.  The queue id is used with
344    other message related directives to access the message queue.
345
346NOTES:
347    This directive will not cause the running task to be preempted.
348
349    If node is ``RTEMS_SEARCH_ALL_NODES``, all nodes are searched with the
350    local node being searched first.  All other nodes are searched with the
351    lowest numbered node searched first.
352
353    If node is a valid node number which does not represent the local node,
354    then only the message queues exported by the designated node are searched.
355
356    This directive does not generate activity on remote nodes.  It accesses
357    only the local copy of the global object table.
358
359.. raw:: latex
360
361   \clearpage
362
363.. index:: delete a message queue
364.. index:: rtems_message_queue_delete
365
366.. _rtems_message_queue_delete:
367
368MESSAGE_QUEUE_DELETE - Delete a queue
369-------------------------------------
370
371CALLING SEQUENCE:
372    .. code-block:: c
373
374        rtems_status_code rtems_message_queue_delete(
375            rtems_id id
376        );
377
378DIRECTIVE STATUS CODES:
379    .. list-table::
380     :class: rtems-table
381
382     * - ``RTEMS_SUCCESSFUL``
383       - queue deleted successfully
384     * - ``RTEMS_INVALID_ID``
385       - invalid queue id
386     * - ``RTEMS_ILLEGAL_ON_REMOTE_OBJECT``
387       - cannot delete remote queue
388
389DESCRIPTION:
390    This directive deletes the message queue specified by ``id``.  As a result
391    of this directive, all tasks blocked waiting to receive a message from this
392    queue will be readied and returned a status code which indicates that the
393    message queue was deleted.  If no tasks are waiting, but the queue contains
394    messages, then RTEMS returns these message buffers back to the system
395    message buffer pool.  The QCB for this queue as well as the memory for the
396    message buffers is reclaimed by RTEMS.
397
398NOTES:
399    The calling task will be preempted if its preemption mode is enabled and
400    one or more local tasks with a higher priority than the calling task are
401    waiting on the deleted queue.  The calling task will NOT be preempted if
402    the tasks that are waiting are remote tasks.
403
404    The calling task does not have to be the task that created the queue,
405    although the task and queue must reside on the same node.
406
407    When the queue is deleted, any messages in the queue are returned to the
408    free message buffer pool.  Any information stored in those messages is
409    lost.
410
411    When a global message queue is deleted, the message queue id must be
412    transmitted to every node in the system for deletion from the local copy of
413    the global object table.
414
415    Proxies, used to represent remote tasks, are reclaimed when the message
416    queue is deleted.
417
418.. raw:: latex
419
420   \clearpage
421
422.. index:: send message to a queue
423.. index:: rtems_message_queue_send
424
425.. _rtems_message_queue_send:
426
427MESSAGE_QUEUE_SEND - Put message at rear of a queue
428---------------------------------------------------
429
430CALLING SEQUENCE:
431    .. code-block:: c
432
433        rtems_status_code rtems_message_queue_send(
434            rtems_id    id,
435            const void *buffer,
436            size_t      size
437        );
438
439DIRECTIVE STATUS CODES:
440    .. list-table::
441     :class: rtems-table
442
443     * - ``RTEMS_SUCCESSFUL``
444       - message sent successfully
445     * - ``RTEMS_INVALID_ID``
446       - invalid queue id
447     * - ``RTEMS_INVALID_SIZE``
448       - invalid message size
449     * - ``RTEMS_INVALID_ADDRESS``
450       - ``buffer`` is NULL
451     * - ``RTEMS_UNSATISFIED``
452       - out of message buffers
453     * - ``RTEMS_TOO_MANY``
454       - queue's limit has been reached
455
456DESCRIPTION:
457    This directive sends the message buffer of size bytes in length to the
458    queue specified by id.  If a task is waiting at the queue, then the message
459    is copied to the waiting task's buffer and the task is unblocked. If no
460    tasks are waiting at the queue, then the message is copied to a message
461    buffer which is obtained from this message queue's message buffer pool.
462    The message buffer is then placed at the rear of the queue.
463
464NOTES:
465    The calling task will be preempted if it has preemption enabled and a
466    higher priority task is unblocked as the result of this directive.
467
468    Sending a message to a global message queue which does not reside on the
469    local node will generate a request to the remote node to post the message
470    on the specified message queue.
471
472    If the task to be unblocked resides on a different node from the message
473    queue, then the message is forwarded to the appropriate node, the waiting
474    task is unblocked, and the proxy used to represent the task is reclaimed.
475
476.. raw:: latex
477
478   \clearpage
479
480.. index:: put message at front of queue
481.. index:: rtems_message_queue_urgent
482
483.. _rtems_message_queue_urgent:
484
485MESSAGE_QUEUE_URGENT - Put message at front of a queue
486------------------------------------------------------
487
488**CALLING SEQUENCE:**
489    .. code-block:: c
490
491        rtems_status_code rtems_message_queue_urgent(
492            rtems_id    id,
493            const void *buffer,
494            size_t      size
495        );
496
497DIRECTIVE STATUS CODES:
498    .. list-table::
499     :class: rtems-table
500
501     * - ``RTEMS_SUCCESSFUL``
502       - message sent successfully
503     * - ``RTEMS_INVALID_ID``
504       - invalid queue id
505     * - ``RTEMS_INVALID_SIZE``
506       - invalid message size
507     * - ``RTEMS_INVALID_ADDRESS``
508       - ``buffer`` is NULL
509     * - ``RTEMS_UNSATISFIED``
510       - out of message buffers
511     * - ``RTEMS_TOO_MANY``
512       - queue's limit has been reached
513
514DESCRIPTION:
515    This directive sends the message buffer of size bytes in length to the
516    queue specified by id.  If a task is waiting on the queue, then the message
517    is copied to the task's buffer and the task is unblocked.  If no tasks are
518    waiting on the queue, then the message is copied to a message buffer which
519    is obtained from this message queue's message buffer pool.  The message
520    buffer is then placed at the front of the queue.
521
522NOTES:
523    The calling task will be preempted if it has preemption enabled and a
524    higher priority task is unblocked as the result of this directive.
525
526    Sending a message to a global message queue which does not reside on the
527    local node will generate a request telling the remote node to post the
528    message on the specified message queue.
529
530    If the task to be unblocked resides on a different node from the message
531    queue, then the message is forwarded to the appropriate node, the waiting
532    task is unblocked, and the proxy used to represent the task is reclaimed.
533
534.. raw:: latex
535
536   \clearpage
537
538.. index:: broadcast message to a queue
539.. index:: rtems_message_queue_broadcast
540
541.. _rtems_message_queue_broadcast:
542
543MESSAGE_QUEUE_BROADCAST - Broadcast N messages to a queue
544---------------------------------------------------------
545
546CALLING SEQUENCE:
547    .. code-block:: c
548
549        rtems_status_code rtems_message_queue_broadcast(
550            rtems_id    id,
551            const void *buffer,
552            size_t      size,
553            uint32_t   *count
554        );
555
556DIRECTIVE STATUS CODES:
557    .. list-table::
558     :class: rtems-table
559
560     * - ``RTEMS_SUCCESSFUL``
561       - message broadcasted successfully
562     * - ``RTEMS_INVALID_ID``
563       - invalid queue id
564     * - ``RTEMS_INVALID_ADDRESS``
565       - ``buffer`` is NULL
566     * - ``RTEMS_INVALID_ADDRESS``
567       - ``count`` is NULL
568     * - ``RTEMS_INVALID_SIZE``
569       - invalid message size
570
571DESCRIPTION:
572    This directive causes all tasks that are waiting at the queue specified by
573    id to be unblocked and sent the message contained in buffer.  Before a task
574    is unblocked, the message buffer of size byes in length is copied to that
575    task's message buffer.  The number of tasks that were unblocked is returned
576    in count.
577
578NOTES:
579    The calling task will be preempted if it has preemption enabled and a
580    higher priority task is unblocked as the result of this directive.
581
582    The execution time of this directive is directly related to the number of
583    tasks waiting on the message queue, although it is more efficient than the
584    equivalent number of invocations of ``rtems_message_queue_send``.
585
586    Broadcasting a message to a global message queue which does not reside on
587    the local node will generate a request telling the remote node to broadcast
588    the message to the specified message queue.
589
590    When a task is unblocked which resides on a different node from the message
591    queue, a copy of the message is forwarded to the appropriate node, the
592    waiting task is unblocked, and the proxy used to represent the task is
593    reclaimed.
594
595.. raw:: latex
596
597   \clearpage
598
599.. index:: receive message from a queue
600.. index:: rtems_message_queue_receive
601
602.. _rtems_message_queue_receive:
603
604MESSAGE_QUEUE_RECEIVE - Receive message from a queue
605----------------------------------------------------
606
607CALLING SEQUENCE:
608    .. code-block:: c
609
610        rtems_status_code rtems_message_queue_receive(
611            rtems_id        id,
612            void           *buffer,
613            size_t         *size,
614            rtems_option    option_set,
615            rtems_interval  timeout
616        );
617
618DIRECTIVE STATUS CODES:
619    .. list-table::
620     :class: rtems-table
621
622     * - ``RTEMS_SUCCESSFUL``
623       - message received successfully
624     * - ``RTEMS_INVALID_ID``
625       - invalid queue id
626     * - ``RTEMS_INVALID_ADDRESS``
627       - ``buffer`` is NULL
628     * - ``RTEMS_INVALID_ADDRESS``
629       - ``size`` is NULL
630     * - ``RTEMS_UNSATISFIED``
631       - queue is empty
632     * - ``RTEMS_TIMEOUT``
633       - timed out waiting for message
634     * - ``RTEMS_OBJECT_WAS_DELETED``
635       - queue deleted while waiting
636
637DESCRIPTION:
638    This directive receives a message from the message queue specified in id.
639    The ``RTEMS_WAIT`` and ``RTEMS_NO_WAIT`` options of the options parameter
640    allow the calling task to specify whether to wait for a message to become
641    available or return immediately.  For either option, if there is at least
642    one message in the queue, then it is copied to buffer, size is set to
643    return the length of the message in bytes, and this directive returns
644    immediately with a successful return code.  The buffer has to be big enough
645    to receive a message of the maximum length with respect to this message
646    queue.
647
648    If the calling task chooses to return immediately and the queue is empty,
649    then a status code indicating this condition is returned.  If the calling
650    task chooses to wait at the message queue and the queue is empty, then the
651    calling task is placed on the message wait queue and blocked.  If the queue
652    was created with the ``RTEMS_PRIORITY`` option specified, then the calling
653    task is inserted into the wait queue according to its priority.  But, if
654    the queue was created with the ``RTEMS_FIFO`` option specified, then the
655    calling task is placed at the rear of the wait queue.
656
657    A task choosing to wait at the queue can optionally specify a timeout value
658    in the timeout parameter.  The timeout parameter specifies the maximum
659    interval to wait before the calling task desires to be unblocked.  If it is
660    set to ``RTEMS_NO_TIMEOUT``, then the calling task will wait forever.
661
662NOTES:
663    The following message receive option constants are defined by RTEMS:
664
665    .. list-table::
666     :class: rtems-table
667
668     * - ``RTEMS_WAIT``
669       - task will wait for a message (default)
670     * - ``RTEMS_NO_WAIT``
671       - task should not wait
672
673    Receiving a message from a global message queue which does not reside on
674    the local node will generate a request to the remote node to obtain a
675    message from the specified message queue.  If no message is available and
676    ``RTEMS_WAIT`` was specified, then the task must be blocked until a message
677    is posted.  A proxy is allocated on the remote node to represent the task
678    until the message is posted.
679
680    A clock tick is required to support the timeout functionality of this
681    directive.
682
683.. raw:: latex
684
685   \clearpage
686
687.. index:: get number of pending messages
688.. index:: rtems_message_queue_get_number_pending
689
690.. _rtems_message_queue_get_number_pending:
691
692MESSAGE_QUEUE_GET_NUMBER_PENDING - Get number of messages pending on a queue
693----------------------------------------------------------------------------
694
695CALLING SEQUENCE:
696    .. code-block:: c
697
698        rtems_status_code rtems_message_queue_get_number_pending(
699            rtems_id  id,
700            uint32_t *count
701        );
702
703DIRECTIVE STATUS CODES:
704    .. list-table::
705     :class: rtems-table
706
707     * - ``RTEMS_SUCCESSFUL``
708       - number of messages pending returned successfully
709     * - ``RTEMS_INVALID_ADDRESS``
710       - ``count`` is NULL
711     * - ``RTEMS_INVALID_ID``
712       - invalid queue id
713
714DESCRIPTION:
715    This directive returns the number of messages pending on this message queue
716    in count.  If no messages are present on the queue, count is set to zero.
717
718NOTES:
719    Getting the number of pending messages on a global message queue which does
720    not reside on the local node will generate a request to the remote node to
721    actually obtain the pending message count for the specified message queue.
722
723.. raw:: latex
724
725   \clearpage
726
727.. index:: flush messages on a queue
728.. index:: rtems_message_queue_flush
729
730.. _rtems_message_queue_flush:
731
732MESSAGE_QUEUE_FLUSH - Flush all messages on a queue
733---------------------------------------------------
734
735CALLING SEQUENCE:
736    .. code-block:: c
737
738        rtems_status_code rtems_message_queue_flush(
739            rtems_id  id,
740            uint32_t *count
741        );
742
743DIRECTIVE STATUS CODES:
744    .. list-table::
745     :class: rtems-table
746
747     * - ``RTEMS_SUCCESSFUL``
748       - message queue flushed successfully
749     * - ``RTEMS_INVALID_ADDRESS``
750       - ``count`` is NULL
751     * - ``RTEMS_INVALID_ID``
752       - invalid queue id
753
754DESCRIPTION:
755    This directive removes all pending messages from the specified queue id.
756    The number of messages removed is returned in count.  If no messages are
757    present on the queue, count is set to zero.
758
759NOTES:
760    Flushing all messages on a global message queue which does not reside on
761    the local node will generate a request to the remote node to actually flush
762    the specified message queue.
Note: See TracBrowser for help on using the repository browser.