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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [score/] [src/] [coremsgclose.c] - Blame information for rev 609

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

Line No. Rev Author Line
1 30 unneback
/*
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.OARcorp.com/rtems/license.html.
16
 *
17
 *  $Id: coremsgclose.c,v 1.2 2001-09-27 11:59:34 chris Exp $
18
 */
19
 
20
#include <rtems/system.h>
21
#include <rtems/score/chain.h>
22
#include <rtems/score/isr.h>
23
#include <rtems/score/object.h>
24
#include <rtems/score/coremsg.h>
25
#include <rtems/score/states.h>
26
#include <rtems/score/thread.h>
27
#include <rtems/score/wkspace.h>
28
#if defined(RTEMS_MULTIPROCESSING)
29
#include <rtems/score/mpci.h>
30
#endif
31
 
32
/*PAGE
33
 *
34
 *  _CORE_message_queue_Close
35
 *
36
 *  This function closes a message by returning all allocated space and
37
 *  flushing the message_queue's task wait queue.
38
 *
39
 *  Input parameters:
40
 *    the_message_queue      - the message_queue to be flushed
41
 *    remote_extract_callout - function to invoke remotely
42
 *    status                 - status to pass to thread
43
 *
44
 *  Output parameters:  NONE
45
 */
46
 
47
void _CORE_message_queue_Close(
48
  CORE_message_queue_Control *the_message_queue,
49
  Thread_queue_Flush_callout  remote_extract_callout,
50
  unsigned32                  status
51
)
52
{
53
 
54
  /*
55
   *  This will flush blocked threads whether they were blocked on
56
   *  a send or receive.
57
   */
58
 
59
  _Thread_queue_Flush(
60
    &the_message_queue->Wait_queue,
61
    remote_extract_callout,
62
    status
63
  );
64
 
65
  /*
66
   *  This removes all messages from the pending message queue.  Since
67
   *  we just flushed all waiting threads, we don't have to worry about
68
   *  the flush satisfying any blocked senders as a side-effect.
69
   */
70
 
71
  if ( the_message_queue->number_of_pending_messages != 0 )
72
    (void) _CORE_message_queue_Flush_support( the_message_queue );
73
 
74
  (void) _Workspace_Free( the_message_queue->message_buffers );
75
 
76
}
77
 

powered by: WebSVN 2.1.0

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