source: rtems/cpukit/score/src/coremsgclose.c @ e3f6d35

4.10
Last change on this file since e3f6d35 was b3836ce, checked in by Joel Sherrill <joel.sherrill@…>, on 09/05/08 at 21:54:20

2008-09-05 Joel Sherrill <joel.sherrill@…>

  • score/src/corebarrier.c, score/src/corebarrierrelease.c, score/src/corebarrierwait.c, score/src/coremsg.c, score/src/coremsgbroadcast.c, score/src/coremsgclose.c, score/src/coremsgflush.c, score/src/coremsgflushsupp.c, score/src/coremsgflushwait.c, score/src/coremsginsert.c, score/src/coremsgseize.c, score/src/coremsgsubmit.c, score/src/corerwlock.c, score/src/coresem.c, score/src/coresemflush.c, score/src/coresemseize.c, score/src/coresemsurrender.c, score/src/corespinlock.c, score/src/threadblockingoperationcancel.c, score/src/threadqenqueue.c: Remove unnecessary include of mpci.h.
  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 *  CORE Message Queue Handler
3 *
4 *  DESCRIPTION:
5 *
6 *  This package is the implementation of the CORE Message Queue Handler.
7 *  This core object provides task synchronization and communication functions
8 *  via messages passed to queue objects.
9 *
10 *  COPYRIGHT (c) 1989-1999.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.com/license/LICENSE.
16 *
17 *  $Id$
18 */
19
20#if HAVE_CONFIG_H
21#include "config.h"
22#endif
23
24#include <rtems/system.h>
25#include <rtems/score/chain.h>
26#include <rtems/score/isr.h>
27#include <rtems/score/object.h>
28#include <rtems/score/coremsg.h>
29#include <rtems/score/states.h>
30#include <rtems/score/thread.h>
31#include <rtems/score/wkspace.h>
32
33/*PAGE
34 *
35 *  _CORE_message_queue_Close
36 *
37 *  This function closes a message by returning all allocated space and
38 *  flushing the message_queue's task wait queue.
39 *
40 *  Input parameters:
41 *    the_message_queue      - the message_queue to be flushed
42 *    remote_extract_callout - function to invoke remotely
43 *    status                 - status to pass to thread
44 *
45 *  Output parameters:  NONE
46 */
47
48void _CORE_message_queue_Close(
49  CORE_message_queue_Control *the_message_queue,
50  Thread_queue_Flush_callout  remote_extract_callout,
51  uint32_t                    status
52)
53{
54
55  /*
56   *  This will flush blocked threads whether they were blocked on
57   *  a send or receive.
58   */
59
60  _Thread_queue_Flush(
61    &the_message_queue->Wait_queue,
62    remote_extract_callout,
63    status
64  );
65
66  /*
67   *  This removes all messages from the pending message queue.  Since
68   *  we just flushed all waiting threads, we don't have to worry about
69   *  the flush satisfying any blocked senders as a side-effect.
70   */
71
72  if ( the_message_queue->number_of_pending_messages != 0 )
73    (void) _CORE_message_queue_Flush_support( the_message_queue );
74
75  (void) _Workspace_Free( the_message_queue->message_buffers );
76
77}
Note: See TracBrowser for help on using the repository browser.