source: rtems/cpukit/rtems/src/msgqsend.c @ 7af4d67

5
Last change on this file since 7af4d67 was 7af4d67, checked in by Sebastian Huber <sebastian.huber@…>, on 05/24/16 at 10:00:32

mpci: Add missing return statements

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/**
2 * @file
3 *
4 * @brief rtems_message_queue_send
5 * @ingroup ClassicMessageQueue Message Queues
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
23rtems_status_code rtems_message_queue_send(
24  rtems_id    id,
25  const void *buffer,
26  size_t      size
27)
28{
29  Message_queue_Control     *the_message_queue;
30  ISR_lock_Context           lock_context;
31  CORE_message_queue_Status  status;
32
33  if ( buffer == NULL ) {
34    return RTEMS_INVALID_ADDRESS;
35  }
36
37  the_message_queue = _Message_queue_Get( id, &lock_context );
38
39  if ( the_message_queue == NULL ) {
40#if defined(RTEMS_MULTIPROCESSING)
41    return _Message_queue_MP_Send( id, buffer, size );
42#else
43    return RTEMS_INVALID_ID;
44#endif
45  }
46
47  _CORE_message_queue_Acquire_critical(
48    &the_message_queue->message_queue,
49    &lock_context
50  );
51  status = _CORE_message_queue_Send(
52    &the_message_queue->message_queue,
53    buffer,
54    size,
55    _Message_queue_Core_message_queue_mp_support,
56    id,
57    false,   /* sender does not block */
58    0,       /* no timeout */
59    &lock_context
60  );
61
62  /*
63   *  Since this API does not allow for blocking sends, we can directly
64   *  return the returned status.
65   */
66
67  return _Message_queue_Translate_core_message_queue_return_code( status );
68}
Note: See TracBrowser for help on using the repository browser.