1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup RTEMSImplClassicMessage |
---|
5 | * |
---|
6 | * @brief This source file contains the implementation of |
---|
7 | * rtems_message_queue_urgent(). |
---|
8 | */ |
---|
9 | |
---|
10 | /* |
---|
11 | * COPYRIGHT (c) 1989-2014. |
---|
12 | * On-Line Applications Research Corporation (OAR). |
---|
13 | * |
---|
14 | * The license and distribution terms for this file may be |
---|
15 | * found in the file LICENSE in this distribution or at |
---|
16 | * http://www.rtems.org/license/LICENSE. |
---|
17 | */ |
---|
18 | |
---|
19 | #ifdef HAVE_CONFIG_H |
---|
20 | #include "config.h" |
---|
21 | #endif |
---|
22 | |
---|
23 | #include <rtems/rtems/messageimpl.h> |
---|
24 | #include <rtems/rtems/statusimpl.h> |
---|
25 | |
---|
26 | rtems_status_code rtems_message_queue_urgent( |
---|
27 | rtems_id id, |
---|
28 | const void *buffer, |
---|
29 | size_t size |
---|
30 | ) |
---|
31 | { |
---|
32 | Message_queue_Control *the_message_queue; |
---|
33 | Thread_queue_Context queue_context; |
---|
34 | Status_Control status; |
---|
35 | |
---|
36 | if ( buffer == NULL ) { |
---|
37 | return RTEMS_INVALID_ADDRESS; |
---|
38 | } |
---|
39 | |
---|
40 | the_message_queue = _Message_queue_Get( id, &queue_context ); |
---|
41 | |
---|
42 | if ( the_message_queue == NULL ) { |
---|
43 | #if defined(RTEMS_MULTIPROCESSING) |
---|
44 | return _Message_queue_MP_Urgent( id, buffer, size ); |
---|
45 | #else |
---|
46 | return RTEMS_INVALID_ID; |
---|
47 | #endif |
---|
48 | } |
---|
49 | |
---|
50 | _CORE_message_queue_Acquire_critical( |
---|
51 | &the_message_queue->message_queue, |
---|
52 | &queue_context |
---|
53 | ); |
---|
54 | _Thread_queue_Context_set_MP_callout( |
---|
55 | &queue_context, |
---|
56 | _Message_queue_Core_message_queue_mp_support |
---|
57 | ); |
---|
58 | status = _CORE_message_queue_Urgent( |
---|
59 | &the_message_queue->message_queue, |
---|
60 | buffer, |
---|
61 | size, |
---|
62 | false, /* sender does not block */ |
---|
63 | &queue_context |
---|
64 | ); |
---|
65 | return _Status_Get( status ); |
---|
66 | } |
---|