source: rtems/cpukit/rtems/src/msgqbroadcast.c @ 1e1b3e00

4.104.114.84.95
Last change on this file since 1e1b3e00 was 1e1b3e00, checked in by Joel Sherrill <joel.sherrill@…>, on 05/17/99 at 22:52:59

Split Message Manager into one routine per file.

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