4.115
Last change
on this file since cc18d7b was
cc18d7b,
checked in by Sebastian Huber <sebastian.huber@…>, on 04/30/15 at 11:12:54
|
score: Fine grained locking for message queues
Aggregate several critical sections into a bigger one. Sending and
receiving messages is now protected by an ISR lock. Thread dispatching
is only disabled in case a blocking operation is necessary. The message
copy procedure is done inside the critical section (interrupts
disabled). Thus this change may have a negative impact on the interrupt
latency in case very large messages are transferred.
Update #2273.
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Close a Message Queue |
---|
5 | * @ingroup ScoreMessageQueue |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-1999. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/score/coremsgimpl.h> |
---|
22 | #include <rtems/score/wkspace.h> |
---|
23 | |
---|
24 | void _CORE_message_queue_Close( |
---|
25 | CORE_message_queue_Control *the_message_queue, |
---|
26 | Thread_queue_Flush_callout remote_extract_callout, |
---|
27 | uint32_t status |
---|
28 | ) |
---|
29 | { |
---|
30 | ISR_lock_Context lock_context; |
---|
31 | |
---|
32 | /* |
---|
33 | * This will flush blocked threads whether they were blocked on |
---|
34 | * a send or receive. |
---|
35 | */ |
---|
36 | |
---|
37 | _Thread_queue_Flush( |
---|
38 | &the_message_queue->Wait_queue, |
---|
39 | remote_extract_callout, |
---|
40 | status |
---|
41 | ); |
---|
42 | |
---|
43 | /* |
---|
44 | * This removes all messages from the pending message queue. Since |
---|
45 | * we just flushed all waiting threads, we don't have to worry about |
---|
46 | * the flush satisfying any blocked senders as a side-effect. |
---|
47 | */ |
---|
48 | |
---|
49 | _ISR_lock_ISR_disable( &lock_context ); |
---|
50 | (void) _CORE_message_queue_Flush( the_message_queue, &lock_context ); |
---|
51 | |
---|
52 | (void) _Workspace_Free( the_message_queue->message_buffers ); |
---|
53 | |
---|
54 | _Thread_queue_Destroy( &the_message_queue->Wait_queue ); |
---|
55 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.