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