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.OARcorp.com/rtems/license.html. |
---|
16 | * |
---|
17 | * $Id$ |
---|
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_Flush_waiting_threads |
---|
35 | * |
---|
36 | * This function flushes the message_queue's task wait queue. The number |
---|
37 | * of messages flushed from the queue is returned. |
---|
38 | * |
---|
39 | * Input parameters: |
---|
40 | * the_message_queue - the message_queue to be flushed |
---|
41 | * |
---|
42 | * Output parameters: |
---|
43 | * returns - the number of messages flushed from the queue |
---|
44 | */ |
---|
45 | |
---|
46 | void _CORE_message_queue_Flush_waiting_threads( |
---|
47 | CORE_message_queue_Control *the_message_queue |
---|
48 | ) |
---|
49 | { |
---|
50 | /* XXX this is not supported for global message queues */ |
---|
51 | |
---|
52 | /* |
---|
53 | * IF there are no pending messages, |
---|
54 | * THEN threads may be blocked waiting to RECEIVE a message, |
---|
55 | * |
---|
56 | * IF the pending message queue is full |
---|
57 | * THEN threads may be blocked waiting to SEND a message |
---|
58 | * |
---|
59 | * But in either case, we will return "unsatisfied nowait" |
---|
60 | * to indicate that the blocking condition was not satisfied |
---|
61 | * and that the blocking state was canceled. |
---|
62 | */ |
---|
63 | |
---|
64 | _Thread_queue_Flush( |
---|
65 | &the_message_queue->Wait_queue, |
---|
66 | NULL, |
---|
67 | CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT |
---|
68 | ); |
---|
69 | } |
---|
70 | |
---|