source: rtems/cpukit/posix/src/mqueuedeletesupp.c @ ec8472e0

Last change on this file since ec8472e0 was ec8472e0, checked in by Joel Sherrill <joel.sherrill@…>, on 02/26/04 at 14:29:02

2004-02-26 Joel Sherrill <joel@…>

PR 582/core

  • src/mqueue.c, src/mqueuecreatesupp.c, src/mqueuedeletesupp.c, src/mqueueunlink.c: Use memory from workspace to avoid use of mutex during dispatch disable critical section. Besides memory for object names should come from the Workspace anyway.
  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 *  NOTE:  The structure of the routines is identical to that of POSIX
3 *         Message_queues to leave the option of having unnamed message
4 *         queues at a future date.  They are currently not part of the
5 *         POSIX standard but unnamed message_queues are.  This is also
6 *         the reason for the apparently unnecessary tracking of
7 *         the process_shared attribute.  [In addition to the fact that
8 *         it would be trivial to add pshared to the mq_attr structure
9 *         and have process private message queues.]
10 *
11 *         This code ignores the O_RDONLY/O_WRONLY/O_RDWR flag at open
12 *         time.
13 *
14 *  $Id$
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <stdarg.h>
22
23#include <pthread.h>
24#include <limits.h>
25#include <errno.h>
26#include <fcntl.h>
27#include <mqueue.h>
28
29#include <rtems/system.h>
30#include <rtems/score/watchdog.h>
31#include <rtems/score/wkspace.h>
32#include <rtems/seterr.h>
33#include <rtems/posix/mqueue.h>
34#include <rtems/posix/time.h>
35
36/*PAGE
37 *
38 *  _POSIX_Message_queue_Delete
39 */
40 
41void _POSIX_Message_queue_Delete(
42  POSIX_Message_queue_Control *the_mq
43)
44{
45  if ( !the_mq->linked && !the_mq->open_count ) {
46      /* the name memory may have been freed by unlink. */
47      if ( the_mq->Object.name )
48        _Workspace_Free( the_mq->Object.name );
49
50      _Objects_Close( &_POSIX_Message_queue_Information, &the_mq->Object );
51 
52      _CORE_message_queue_Close(
53        &the_mq->Message_queue,
54        NULL,        /* no MP support */
55        CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED
56      );
57
58    _POSIX_Message_queue_Free( the_mq );
59 
60#if 0 && defined(RTEMS_MULTIPROCESSING)
61    if ( the_mq->process_shared == PTHREAD_PROCESS_SHARED ) {
62 
63      _Objects_MP_Close(
64        &_POSIX_Message_queue_Information,
65        the_mq->Object.id
66      );
67 
68      _POSIX_Message_queue_MP_Send_process_packet(
69        POSIX_MESSAGE_QUEUE_MP_ANNOUNCE_DELETE,
70        the_mq->Object.id,
71        0,                         /* Not used */
72        0                          /* Not used */
73      );
74    }
75#endif
76 
77  }
78}
79
Note: See TracBrowser for help on using the repository browser.