RTEMS
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 
23 
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 
47  &the_message_queue->message_queue,
48  &queue_context
49  );
50  *count = the_message_queue->message_queue.number_of_pending_messages;
52  &the_message_queue->message_queue,
53  &queue_context
54  );
55  return RTEMS_SUCCESSFUL;
56 }
Thread queue context for the thread queue methods.
Definition: threadq.h:198
Classic Message Queue Manager Implementation.
uint32_t number_of_pending_messages
Definition: coremsg.h:113
This status code indicates successful completion.
Definition: status.h:86
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
CORE_message_queue_Control message_queue
Definition: messagedata.h:42
rtems_status_code rtems_message_queue_get_number_pending(rtems_id id, uint32_t *count)
%
This status code indicates that a specified address was invalid.
Definition: status.h:133
This status code indicates that an object identifier was invalid.
Definition: status.h:106
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
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
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