source: rtems/doc/user/msg.t @ d1996079

4.104.114.84.95
Last change on this file since d1996079 was 6449498, checked in by Joel Sherrill <joel.sherrill@…>, on 01/17/02 at 21:47:47

2001-01-17 Joel Sherrill <joel@…>

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