4.115
Last change
on this file since c499856 was
c499856,
checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47
|
Change all references of rtems.com to rtems.org.
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Thread Queue Dequeue |
---|
5 | * |
---|
6 | * @ingroup ScoreThreadQ |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1989-2008. |
---|
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.org/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #if HAVE_CONFIG_H |
---|
19 | #include "config.h" |
---|
20 | #endif |
---|
21 | |
---|
22 | #include <rtems/score/threadqimpl.h> |
---|
23 | #include <rtems/score/isrlevel.h> |
---|
24 | |
---|
25 | Thread_Control *_Thread_queue_Dequeue( |
---|
26 | Thread_queue_Control *the_thread_queue |
---|
27 | ) |
---|
28 | { |
---|
29 | Thread_Control *(*dequeue_p)( Thread_queue_Control * ); |
---|
30 | Thread_Control *the_thread; |
---|
31 | ISR_Level level; |
---|
32 | Thread_blocking_operation_States sync_state; |
---|
33 | |
---|
34 | if ( the_thread_queue->discipline == THREAD_QUEUE_DISCIPLINE_PRIORITY ) |
---|
35 | dequeue_p = _Thread_queue_Dequeue_priority; |
---|
36 | else /* must be THREAD_QUEUE_DISCIPLINE_FIFO */ |
---|
37 | dequeue_p = _Thread_queue_Dequeue_fifo; |
---|
38 | |
---|
39 | the_thread = (*dequeue_p)( the_thread_queue ); |
---|
40 | _ISR_Disable( level ); |
---|
41 | if ( !the_thread ) { |
---|
42 | sync_state = the_thread_queue->sync_state; |
---|
43 | if ( (sync_state == THREAD_BLOCKING_OPERATION_TIMEOUT) || |
---|
44 | (sync_state == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED) ) { |
---|
45 | the_thread_queue->sync_state = THREAD_BLOCKING_OPERATION_SATISFIED; |
---|
46 | the_thread = _Thread_Executing; |
---|
47 | } |
---|
48 | } |
---|
49 | _ISR_Enable( level ); |
---|
50 | return the_thread; |
---|
51 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.