RTEMS
cpukit
rtems
src
msgqgetnumberpending.c
Go to the documentation of this file.
1
9
/*
10
* COPYRIGHT (c) 1989-2014.
11
* On-Line Applications Research Corporation (OAR).
12
*
13
* The license and distribution terms for this file may be
14
* found in the file LICENSE in this distribution or at
15
* http://www.rtems.org/license/LICENSE.
16
*/
17
18
#ifdef HAVE_CONFIG_H
19
#include "config.h"
20
#endif
21
22
#include <
rtems/rtems/messageimpl.h
>
23
24
rtems_status_code
rtems_message_queue_get_number_pending
(
25
rtems_id
id
,
26
uint32_t *count
27
)
28
{
29
Message_queue_Control
*the_message_queue;
30
Thread_queue_Context
queue_context;
31
32
if
( count == NULL ) {
33
return
RTEMS_INVALID_ADDRESS
;
34
}
35
36
the_message_queue = _Message_queue_Get(
id
, &queue_context );
37
38
if
( the_message_queue == NULL ) {
39
#if defined(RTEMS_MULTIPROCESSING)
40
return
_Message_queue_MP_Get_number_pending(
id
, count );
41
#else
42
return
RTEMS_INVALID_ID
;
43
#endif
44
}
45
46
_CORE_message_queue_Acquire_critical
(
47
&the_message_queue->
message_queue
,
48
&queue_context
49
);
50
*count = the_message_queue->
message_queue
.
number_of_pending_messages
;
51
_CORE_message_queue_Release
(
52
&the_message_queue->
message_queue
,
53
&queue_context
54
);
55
return
RTEMS_SUCCESSFUL
;
56
}
Thread_queue_Context
Thread queue context for the thread queue methods.
Definition:
threadq.h:198
messageimpl.h
Classic Message Queue Manager Implementation.
Message_queue_Control
Definition:
messagedata.h:38
CORE_message_queue_Control::number_of_pending_messages
uint32_t number_of_pending_messages
Definition:
coremsg.h:113
RTEMS_SUCCESSFUL
This status code indicates successful completion.
Definition:
status.h:86
rtems_status_code
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition:
status.h:82
Message_queue_Control::message_queue
CORE_message_queue_Control message_queue
Definition:
messagedata.h:42
rtems_message_queue_get_number_pending
rtems_status_code rtems_message_queue_get_number_pending(rtems_id id, uint32_t *count)
%
Definition:
msgqgetnumberpending.c:24
RTEMS_INVALID_ADDRESS
This status code indicates that a specified address was invalid.
Definition:
status.h:133
RTEMS_INVALID_ID
This status code indicates that an object identifier was invalid.
Definition:
status.h:106
rtems_id
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition:
types.h:99
_CORE_message_queue_Release
static __inline__ void _CORE_message_queue_Release(CORE_message_queue_Control *the_message_queue, Thread_queue_Context *queue_context)
Releases the message queue.
Definition:
coremsgimpl.h:446
_CORE_message_queue_Acquire_critical
static __inline__ void _CORE_message_queue_Acquire_critical(CORE_message_queue_Control *the_message_queue, Thread_queue_Context *queue_context)
Acquires the message queue critical.
Definition:
coremsgimpl.h:432
Generated by
1.8.14