OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [rtems/] [src/] [msgqdelete.c] - Blame information for rev 846

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  Message Queue Manager
3
 *
4
 *
5
 *  COPYRIGHT (c) 1989-1999.
6
 *  On-Line Applications Research Corporation (OAR).
7
 *
8
 *  The license and distribution terms for this file may be
9
 *  found in the file LICENSE in this distribution or at
10
 *  http://www.OARcorp.com/rtems/license.html.
11
 *
12
 *  $Id: msgqdelete.c,v 1.2 2001-09-27 11:59:19 chris Exp $
13
 */
14
 
15
#include <rtems/system.h>
16
#include <rtems/score/sysstate.h>
17
#include <rtems/score/chain.h>
18
#include <rtems/score/isr.h>
19
#include <rtems/score/coremsg.h>
20
#include <rtems/score/object.h>
21
#include <rtems/score/states.h>
22
#include <rtems/score/thread.h>
23
#include <rtems/score/wkspace.h>
24
#if defined(RTEMS_MULTIPROCESSING)
25
#include <rtems/score/mpci.h>
26
#endif
27
#include <rtems/rtems/status.h>
28
#include <rtems/rtems/attr.h>
29
#include <rtems/rtems/message.h>
30
#include <rtems/rtems/options.h>
31
#include <rtems/rtems/support.h>
32
 
33
/*PAGE
34
 *
35
 *  rtems_message_queue_delete
36
 *
37
 *  This directive allows a thread to delete the message queue specified
38
 *  by the given queue identifier.
39
 *
40
 *  Input parameters:
41
 *    id - queue id
42
 *
43
 *  Output parameters:
44
 *    RTEMS_SUCCESSFUL - if successful
45
 *    error code        - if unsuccessful
46
 */
47
 
48
rtems_status_code rtems_message_queue_delete(
49
  Objects_Id id
50
)
51
{
52
  register Message_queue_Control *the_message_queue;
53
  Objects_Locations               location;
54
 
55
  the_message_queue = _Message_queue_Get( id, &location );
56
  switch ( location ) {
57
 
58
    case OBJECTS_REMOTE:
59
#if defined(RTEMS_MULTIPROCESSING)
60
      _Thread_Dispatch();
61
      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
62
#endif
63
 
64
    case OBJECTS_ERROR:
65
      return RTEMS_INVALID_ID;
66
 
67
    case OBJECTS_LOCAL:
68
      _Objects_Close( &_Message_queue_Information,
69
                      &the_message_queue->Object );
70
 
71
      _CORE_message_queue_Close(
72
        &the_message_queue->message_queue,
73
#if defined(RTEMS_MULTIPROCESSING)
74
        _Message_queue_MP_Send_object_was_deleted,
75
#else
76
        NULL,
77
#endif
78
        CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED
79
      );
80
 
81
      _Message_queue_Free( the_message_queue );
82
 
83
#if defined(RTEMS_MULTIPROCESSING)
84
      if ( _Attributes_Is_global( the_message_queue->attribute_set ) ) {
85
        _Objects_MP_Close(
86
          &_Message_queue_Information,
87
          the_message_queue->Object.id
88
        );
89
 
90
        _Message_queue_MP_Send_process_packet(
91
          MESSAGE_QUEUE_MP_ANNOUNCE_DELETE,
92
          the_message_queue->Object.id,
93
          0,                                 /* Not used */
94
 
95
        );
96
      }
97
#endif
98
 
99
      _Thread_Enable_dispatch();
100
      return RTEMS_SUCCESSFUL;
101
  }
102
 
103
  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
104
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.