1 | /* |
---|
2 | * Thread Queue Handler |
---|
3 | * |
---|
4 | * |
---|
5 | * COPYRIGHT (c) 1989-1999. |
---|
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.OARcorp.com/rtems/license.html. |
---|
11 | * |
---|
12 | * $Id$ |
---|
13 | */ |
---|
14 | |
---|
15 | #include <rtems/system.h> |
---|
16 | #include <rtems/score/chain.h> |
---|
17 | #include <rtems/score/isr.h> |
---|
18 | #include <rtems/score/object.h> |
---|
19 | #include <rtems/score/states.h> |
---|
20 | #include <rtems/score/thread.h> |
---|
21 | #include <rtems/score/threadq.h> |
---|
22 | #include <rtems/score/tqdata.h> |
---|
23 | |
---|
24 | /*PAGE |
---|
25 | * |
---|
26 | * _Thread_queue_Extract_fifo |
---|
27 | * |
---|
28 | * This routine removes a specific thread from the specified threadq, |
---|
29 | * deletes any timeout, and unblocks the thread. |
---|
30 | * |
---|
31 | * Input parameters: |
---|
32 | * the_thread_queue - pointer to a threadq header |
---|
33 | * the_thread - pointer to the thread to block |
---|
34 | * |
---|
35 | * Output parameters: NONE |
---|
36 | * |
---|
37 | * INTERRUPT LATENCY: |
---|
38 | * EXTRACT_FIFO |
---|
39 | */ |
---|
40 | |
---|
41 | void _Thread_queue_Extract_fifo( |
---|
42 | Thread_queue_Control *the_thread_queue, |
---|
43 | Thread_Control *the_thread |
---|
44 | ) |
---|
45 | { |
---|
46 | ISR_Level level; |
---|
47 | |
---|
48 | _ISR_Disable( level ); |
---|
49 | |
---|
50 | if ( !_States_Is_waiting_on_thread_queue( the_thread->current_state ) ) { |
---|
51 | _ISR_Enable( level ); |
---|
52 | return; |
---|
53 | } |
---|
54 | |
---|
55 | _Chain_Extract_unprotected( &the_thread->Object.Node ); |
---|
56 | |
---|
57 | if ( !_Watchdog_Is_active( &the_thread->Timer ) ) { |
---|
58 | _ISR_Enable( level ); |
---|
59 | } else { |
---|
60 | _Watchdog_Deactivate( &the_thread->Timer ); |
---|
61 | _ISR_Enable( level ); |
---|
62 | (void) _Watchdog_Remove( &the_thread->Timer ); |
---|
63 | } |
---|
64 | |
---|
65 | _Thread_Unblock( the_thread ); |
---|
66 | |
---|
67 | #if defined(RTEMS_MULTIPROCESSING) |
---|
68 | if ( !_Objects_Is_local_id( the_thread->Object.id ) ) |
---|
69 | _Thread_MP_Free_proxy( the_thread ); |
---|
70 | #endif |
---|
71 | |
---|
72 | } |
---|
73 | |
---|