source: rtems/cpukit/rtems/src/msgqdelete.c @ 63d229d6

4.115
Last change on this file since 63d229d6 was 63d229d6, checked in by Sebastian Huber <sebastian.huber@…>, on 07/23/13 at 09:12:52

rtems: Create attr implementation header

Move implementation specific parts of attr.h and attr.inl into new
header file attrimpl.h. The attr.h contains now only the application
visible API.

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Delete Message Queue
5 *  @ingroup ClassicMessageQueue
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
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.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/score/sysstate.h>
23#include <rtems/score/chain.h>
24#include <rtems/score/isr.h>
25#include <rtems/score/coremsgimpl.h>
26#include <rtems/score/object.h>
27#include <rtems/score/states.h>
28#include <rtems/score/thread.h>
29#include <rtems/score/wkspace.h>
30#if defined(RTEMS_MULTIPROCESSING)
31#include <rtems/score/mpci.h>
32#endif
33#include <rtems/rtems/status.h>
34#include <rtems/rtems/attrimpl.h>
35#include <rtems/rtems/messageimpl.h>
36#include <rtems/rtems/options.h>
37#include <rtems/rtems/support.h>
38
39rtems_status_code rtems_message_queue_delete(
40  rtems_id id
41)
42{
43  register Message_queue_Control *the_message_queue;
44  Objects_Locations               location;
45
46  the_message_queue = _Message_queue_Get( id, &location );
47  switch ( location ) {
48
49    case OBJECTS_LOCAL:
50      _Objects_Close( &_Message_queue_Information,
51                      &the_message_queue->Object );
52
53      _CORE_message_queue_Close(
54        &the_message_queue->message_queue,
55        #if defined(RTEMS_MULTIPROCESSING)
56          _Message_queue_MP_Send_object_was_deleted,
57        #else
58          NULL,
59        #endif
60        CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED
61      );
62
63      _Message_queue_Free( the_message_queue );
64
65#if defined(RTEMS_MULTIPROCESSING)
66      if ( _Attributes_Is_global( the_message_queue->attribute_set ) ) {
67        _Objects_MP_Close(
68          &_Message_queue_Information,
69          the_message_queue->Object.id
70        );
71
72        _Message_queue_MP_Send_process_packet(
73          MESSAGE_QUEUE_MP_ANNOUNCE_DELETE,
74          the_message_queue->Object.id,
75          0,                                 /* Not used */
76          0
77        );
78      }
79#endif
80      _Objects_Put( &the_message_queue->Object );
81      return RTEMS_SUCCESSFUL;
82
83#if defined(RTEMS_MULTIPROCESSING)
84    case OBJECTS_REMOTE:
85      _Thread_Dispatch();
86      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
87#endif
88
89    case OBJECTS_ERROR:
90      break;
91  }
92
93  return RTEMS_INVALID_ID;
94}
Note: See TracBrowser for help on using the repository browser.