source: rtems/cpukit/rtems/src/msgqdelete.c @ 7f04cb18

4.115
Last change on this file since 7f04cb18 was 7f04cb18, checked in by Sebastian Huber <sebastian.huber@…>, on 07/25/13 at 07:10:38

score: Create mpci implementation header

Move implementation specific parts of mpci.h into new header file
mpciimpl.h. The mpci.h contains now only the application visible API.

  • Property mode set to 100644
File size: 2.2 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/chain.h>
23#include <rtems/score/isr.h>
24#include <rtems/score/coremsgimpl.h>
25#include <rtems/score/object.h>
26#include <rtems/score/thread.h>
27#include <rtems/score/wkspace.h>
28#include <rtems/rtems/status.h>
29#include <rtems/rtems/attrimpl.h>
30#include <rtems/rtems/messageimpl.h>
31#include <rtems/rtems/options.h>
32#include <rtems/rtems/support.h>
33
34rtems_status_code rtems_message_queue_delete(
35  rtems_id id
36)
37{
38  register Message_queue_Control *the_message_queue;
39  Objects_Locations               location;
40
41  the_message_queue = _Message_queue_Get( id, &location );
42  switch ( location ) {
43
44    case OBJECTS_LOCAL:
45      _Objects_Close( &_Message_queue_Information,
46                      &the_message_queue->Object );
47
48      _CORE_message_queue_Close(
49        &the_message_queue->message_queue,
50        #if defined(RTEMS_MULTIPROCESSING)
51          _Message_queue_MP_Send_object_was_deleted,
52        #else
53          NULL,
54        #endif
55        CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED
56      );
57
58      _Message_queue_Free( the_message_queue );
59
60#if defined(RTEMS_MULTIPROCESSING)
61      if ( _Attributes_Is_global( the_message_queue->attribute_set ) ) {
62        _Objects_MP_Close(
63          &_Message_queue_Information,
64          the_message_queue->Object.id
65        );
66
67        _Message_queue_MP_Send_process_packet(
68          MESSAGE_QUEUE_MP_ANNOUNCE_DELETE,
69          the_message_queue->Object.id,
70          0,                                 /* Not used */
71          0
72        );
73      }
74#endif
75      _Objects_Put( &the_message_queue->Object );
76      return RTEMS_SUCCESSFUL;
77
78#if defined(RTEMS_MULTIPROCESSING)
79    case OBJECTS_REMOTE:
80      _Thread_Dispatch();
81      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
82#endif
83
84    case OBJECTS_ERROR:
85      break;
86  }
87
88  return RTEMS_INVALID_ID;
89}
Note: See TracBrowser for help on using the repository browser.