source: rtems/cpukit/rtems/src/msgqbroadcast.c @ 8ef3818

4.104.114.84.95
Last change on this file since 8ef3818 was 08311cc3, checked in by Joel Sherrill <joel.sherrill@…>, on 11/17/99 at 17:51:34

Updated copyright notice.

  • Property mode set to 100644
File size: 2.8 KB
Line 
1/*
2 *  Message Queue Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14
15#include <rtems/system.h>
16#include <rtems/score/sysstate.h>
17#include <rtems/score/chain.h>
18#include <rtems/score/isr.h>
19#include <rtems/score/coremsg.h>
20#include <rtems/score/object.h>
21#include <rtems/score/states.h>
22#include <rtems/score/thread.h>
23#include <rtems/score/wkspace.h>
24#if defined(RTEMS_MULTIPROCESSING)
25#include <rtems/score/mpci.h>
26#endif
27#include <rtems/rtems/status.h>
28#include <rtems/rtems/attr.h>
29#include <rtems/rtems/message.h>
30#include <rtems/rtems/options.h>
31#include <rtems/rtems/support.h>
32
33/*PAGE
34 *
35 *  rtems_message_queue_broadcast
36 *
37 *  This directive sends a message for every thread waiting on the queue
38 *  designated by id.
39 *
40 *  Input parameters:
41 *    id     - pointer to message queue
42 *    buffer - pointer to message buffer
43 *    size   - size of message to broadcast
44 *    count  - pointer to area to store number of threads made ready
45 *
46 *  Output parameters:
47 *    count             - number of threads made ready
48 *    RTEMS_SUCCESSFUL  - if successful
49 *    error code        - if unsuccessful
50 */
51
52rtems_status_code rtems_message_queue_broadcast(
53  Objects_Id            id,
54  void                 *buffer,
55  unsigned32            size,
56  unsigned32           *count
57)
58{
59  register Message_queue_Control *the_message_queue;
60  Objects_Locations               location;
61  CORE_message_queue_Status       core_status;
62
63  the_message_queue = _Message_queue_Get( id, &location );
64  switch ( location ) {
65    case OBJECTS_REMOTE:
66#if defined(RTEMS_MULTIPROCESSING)
67      _Thread_Executing->Wait.return_argument = count;
68
69      return
70        _Message_queue_MP_Send_request_packet(
71          MESSAGE_QUEUE_MP_BROADCAST_REQUEST,
72          id,
73          buffer,
74          &size,
75          0,                               /* option_set not used */
76          MPCI_DEFAULT_TIMEOUT
77        );
78#endif
79
80    case OBJECTS_ERROR:
81      return RTEMS_INVALID_ID;
82
83    case OBJECTS_LOCAL:
84      core_status = _CORE_message_queue_Broadcast(
85                      &the_message_queue->message_queue,
86                      buffer,
87                      size,
88                      id,
89#if defined(RTEMS_MULTIPROCESSING)
90                      _Message_queue_Core_message_queue_mp_support,
91#else
92                      NULL,
93#endif
94                      count
95                    );
96                     
97      _Thread_Enable_dispatch();
98      return
99        _Message_queue_Translate_core_message_queue_return_code( core_status );
100
101  }
102  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
103}
Note: See TracBrowser for help on using the repository browser.