1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Restart Thread |
---|
5 | * @ingroup ScoreThread |
---|
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.com/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/system.h> |
---|
22 | #include <rtems/score/apiext.h> |
---|
23 | #include <rtems/score/context.h> |
---|
24 | #include <rtems/score/interr.h> |
---|
25 | #include <rtems/score/isr.h> |
---|
26 | #include <rtems/score/object.h> |
---|
27 | #include <rtems/score/priority.h> |
---|
28 | #include <rtems/score/states.h> |
---|
29 | #include <rtems/score/thread.h> |
---|
30 | #include <rtems/score/threadq.h> |
---|
31 | #include <rtems/score/userextimpl.h> |
---|
32 | #include <rtems/score/wkspace.h> |
---|
33 | |
---|
34 | bool _Thread_Restart( |
---|
35 | Thread_Control *the_thread, |
---|
36 | void *pointer_argument, |
---|
37 | Thread_Entry_numeric_type numeric_argument |
---|
38 | ) |
---|
39 | { |
---|
40 | if ( !_States_Is_dormant( the_thread->current_state ) ) { |
---|
41 | |
---|
42 | _Thread_Set_transient( the_thread ); |
---|
43 | |
---|
44 | _Thread_Reset( the_thread, pointer_argument, numeric_argument ); |
---|
45 | |
---|
46 | _Thread_Load_environment( the_thread ); |
---|
47 | |
---|
48 | _Thread_Ready( the_thread ); |
---|
49 | |
---|
50 | _User_extensions_Thread_restart( the_thread ); |
---|
51 | |
---|
52 | if ( _Thread_Is_executing ( the_thread ) ) |
---|
53 | _Thread_Restart_self(); |
---|
54 | |
---|
55 | return true; |
---|
56 | } |
---|
57 | |
---|
58 | return false; |
---|
59 | } |
---|