source: rtems/cpukit/rtems/src/msgqbroadcast.c @ 66cb142

Last change on this file since 66cb142 was 0e1d11f3, checked in by Sebastian Huber <sebastian.huber@…>, on May 27, 2016 at 11:26:53 AM

score: Add _Thread_queue_Context_set_MP_callout()

Add _Thread_queue_Context_set_MP_callout() to simplify
_Thread_queue_Context_initialize(). This makes it possible to more
easily add additional fields to Thread_queue_Context.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Broadcast Message Queue
5 *  @ingroup ClassicMessageQueue
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2014.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/rtems/messageimpl.h>
22#include <rtems/rtems/statusimpl.h>
23
24rtems_status_code rtems_message_queue_broadcast(
25  rtems_id    id,
26  const void *buffer,
27  size_t      size,
28  uint32_t   *count
29)
30{
31  Message_queue_Control *the_message_queue;
32  Thread_queue_Context   queue_context;
33  Status_Control         status;
34
35  if ( buffer == NULL ) {
36    return RTEMS_INVALID_ADDRESS;
37  }
38
39  if ( count == NULL ) {
40    return RTEMS_INVALID_ADDRESS;
41  }
42
43  the_message_queue = _Message_queue_Get( id, &queue_context );
44
45  if ( the_message_queue == NULL ) {
46#if defined(RTEMS_MULTIPROCESSING)
47    return _Message_queue_MP_Broadcast( id, buffer, size, count );
48#else
49    return RTEMS_INVALID_ID;
50#endif
51  }
52
53  _Thread_queue_Context_set_MP_callout(
54    &queue_context,
55    _Message_queue_Core_message_queue_mp_support
56  );
57  status = _CORE_message_queue_Broadcast(
58    &the_message_queue->message_queue,
59    buffer,
60    size,
61    count,
62    &queue_context
63  );
64  return _Status_Get( status );
65}
Note: See TracBrowser for help on using the repository browser.