source: rtems/cpukit/rtems/src/msgqurgent.c @ c3d8d9e

5
Last change on this file since c3d8d9e was c3d8d9e, checked in by Sebastian Huber <sebastian.huber@…>, on 05/23/16 at 04:55:49

score: Get rid of mp_id parameter

Get rid of the mp_id parameter used for some thread queue methods. Use
THREAD_QUEUE_QUEUE_TO_OBJECT() instead.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Urgent 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
23rtems_status_code rtems_message_queue_urgent(
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_Urgent( 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_Urgent(
52    &the_message_queue->message_queue,
53    buffer,
54    size,
55    _Message_queue_Core_message_queue_mp_support,
56    false,   /* sender does not block */
57    0,       /* no timeout */
58    &lock_context
59  );
60
61  /*
62   *  Since this API does not allow for blocking sends, we can directly
63   *  return the returned status.
64   */
65
66  return _Message_queue_Translate_core_message_queue_return_code( status );
67}
Note: See TracBrowser for help on using the repository browser.