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

5
Last change on this file since 7ee6437 was f23d470, checked in by Gedare Bloom <gedare@…>, on 06/09/16 at 15:33:15

cpukit: Add and use Watchdog_Discipline.

Clock disciplines may be WATCHDOG_RELATIVE, WATCHDOG_ABSOLUTE,
or WATCHDOG_NO_TIMEOUT. A discipline of WATCHDOG_RELATIVE with
a timeout of WATCHDOG_NO_TIMEOUT is equivalent to a discipline
of WATCHDOG_NO_TIMEOUT.

updates #2732

  • Property mode set to 100644
File size: 1.4 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#include <rtems/rtems/statusimpl.h>
23
24rtems_status_code rtems_message_queue_send(
25  rtems_id    id,
26  const void *buffer,
27  size_t      size
28)
29{
30  Message_queue_Control *the_message_queue;
31  Thread_queue_Context   queue_context;
32  Status_Control         status;
33
34  if ( buffer == NULL ) {
35    return RTEMS_INVALID_ADDRESS;
36  }
37
38  the_message_queue = _Message_queue_Get( id, &queue_context );
39
40  if ( the_message_queue == NULL ) {
41#if defined(RTEMS_MULTIPROCESSING)
42    return _Message_queue_MP_Send( id, buffer, size );
43#else
44    return RTEMS_INVALID_ID;
45#endif
46  }
47
48  _CORE_message_queue_Acquire_critical(
49    &the_message_queue->message_queue,
50    &queue_context
51  );
52  _Thread_queue_Context_set_MP_callout(
53    &queue_context,
54    _Message_queue_Core_message_queue_mp_support
55  );
56  status = _CORE_message_queue_Send(
57    &the_message_queue->message_queue,
58    buffer,
59    size,
60    false,   /* sender does not block */
61    &queue_context
62  );
63  return _Status_Get( status );
64}
Note: See TracBrowser for help on using the repository browser.