RTEMS
msgqdelete.c
Go to the documentation of this file.
1 
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 #ifdef HAVE_CONFIG_H
18 #include "config.h"
19 #endif
20 
22 #include <rtems/rtems/attrimpl.h>
23 
25  rtems_id id
26 )
27 {
28  Message_queue_Control *the_message_queue;
29  Thread_queue_Context queue_context;
30 
32  the_message_queue = _Message_queue_Get( id, &queue_context );
33 
34  if ( the_message_queue == NULL ) {
36 
37 #if defined(RTEMS_MULTIPROCESSING)
38  if ( _Message_queue_MP_Is_remote( id ) ) {
40  }
41 #endif
42 
43  return RTEMS_INVALID_ID;
44  }
45 
47  &the_message_queue->message_queue,
48  &queue_context
49  );
50 
51  _Objects_Close( &_Message_queue_Information, &the_message_queue->Object );
52 
54  &queue_context,
55  _Message_queue_MP_Send_object_was_deleted
56  );
58  &the_message_queue->message_queue,
59  &queue_context
60  );
61 
62 #if defined(RTEMS_MULTIPROCESSING)
63  if ( the_message_queue->is_global ) {
64  _Objects_MP_Close(
66  the_message_queue->Object.id
67  );
68 
69  _Message_queue_MP_Send_process_packet(
70  MESSAGE_QUEUE_MP_ANNOUNCE_DELETE,
71  the_message_queue->Object.id,
72  0, /* Not used */
73  0
74  );
75  }
76 #endif
77 
78  _Message_queue_Free( the_message_queue );
80  return RTEMS_SUCCESSFUL;
81 }
static __inline__ void _Objects_Allocator_unlock(void)
Unlocks the object allocator mutex.
Definition: objectimpl.h:846
rtems_status_code rtems_message_queue_delete(rtems_id id)
%
Definition: msgqdelete.c:24
Thread queue context for the thread queue methods.
Definition: threadq.h:198
Classic Message Queue Manager Implementation.
#define _Thread_queue_Context_set_MP_callout(queue_context, mp_callout)
Sets the MP callout in the thread queue context.
Definition: threadqimpl.h:456
void _CORE_message_queue_Close(CORE_message_queue_Control *the_message_queue, Thread_queue_Context *queue_context)
Closes a message queue.
Definition: coremsgclose.c:34
static __inline__ void _Message_queue_Free(Message_queue_Control *the_message_queue)
Deallocates a message queue control block into the inactive chain of free message queue control block...
Definition: messageimpl.h:78
Objects_Control Object
Definition: messagedata.h:40
static __inline__ void _Objects_Allocator_lock(void)
Locks the object allocator mutex.
Definition: objectimpl.h:834
Objects_Information _Message_queue_Information
The Classic Message Queue objects information.
Definition: msg.c:47
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
This status code indicates that an object identifier was invalid.
Definition: status.h:106
Classic Attributes Implementation.
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
This status code indicates that the operation was illegal on a remote object.
Definition: status.h:177
void _Objects_Close(const Objects_Information *information, Objects_Control *the_object)
Closes object.
Definition: objectclose.c:23
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
Objects_Id id
Definition: objectdata.h:43