1 | /* |
---|
2 | * Thread Queue Handler - Process Timeout Handler |
---|
3 | * |
---|
4 | * |
---|
5 | * COPYRIGHT (c) 1989-2008. |
---|
6 | * On-Line Applications Research Corporation (OAR). |
---|
7 | * |
---|
8 | * The license and distribution terms for this file may be |
---|
9 | * found in the file LICENSE in this distribution or at |
---|
10 | * http://www.rtems.com/license/LICENSE. |
---|
11 | * |
---|
12 | * $Id$ |
---|
13 | */ |
---|
14 | |
---|
15 | #if HAVE_CONFIG_H |
---|
16 | #include "config.h" |
---|
17 | #endif |
---|
18 | |
---|
19 | #include <rtems/system.h> |
---|
20 | #include <rtems/score/chain.h> |
---|
21 | #include <rtems/score/isr.h> |
---|
22 | #include <rtems/score/object.h> |
---|
23 | #include <rtems/score/states.h> |
---|
24 | #include <rtems/score/thread.h> |
---|
25 | #include <rtems/score/threadq.h> |
---|
26 | #include <rtems/score/tqdata.h> |
---|
27 | |
---|
28 | void _Thread_queue_Process_timeout( |
---|
29 | Thread_Control *the_thread |
---|
30 | ) |
---|
31 | { |
---|
32 | Thread_queue_Control *the_thread_queue = the_thread->Wait.queue; |
---|
33 | |
---|
34 | /* |
---|
35 | * If the_thread_queue is not synchronized, then it is either |
---|
36 | * "nothing happened", "timeout", or "satisfied". If the_thread |
---|
37 | * is the executing thread, then it is in the process of blocking |
---|
38 | * and it is the thread which is responsible for the synchronization |
---|
39 | * process. |
---|
40 | * |
---|
41 | * If it is not satisfied, then it is "nothing happened" and |
---|
42 | * this is the "timeout" transition. After a request is satisfied, |
---|
43 | * a timeout is not allowed to occur. |
---|
44 | */ |
---|
45 | |
---|
46 | if ( the_thread_queue->sync_state != THREAD_BLOCKING_OPERATION_SYNCHRONIZED && |
---|
47 | _Thread_Is_executing( the_thread ) ) { |
---|
48 | if ( the_thread_queue->sync_state != THREAD_BLOCKING_OPERATION_SATISFIED ) { |
---|
49 | the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; |
---|
50 | the_thread_queue->sync_state = THREAD_BLOCKING_OPERATION_TIMEOUT; |
---|
51 | } |
---|
52 | } else { |
---|
53 | the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; |
---|
54 | _Thread_queue_Extract( the_thread->Wait.queue, the_thread ); |
---|
55 | } |
---|
56 | } |
---|
57 | |
---|