source:
rtems/cpukit/rtems/src/taskrestart.c
@
66cb142
Last change on this file since 66cb142 was e266d13, checked in by Sebastian Huber <sebastian.huber@…>, on 05/20/16 at 13:10:27 | |
---|---|
|
|
File size: 1.2 KB |
Rev | Line | |
---|---|---|
[205dbb9d] | 1 | /** |
2 | * @file | |
[c4d69e2] | 3 | * |
[205dbb9d] | 4 | * @brief RTEMS Task Restart |
5 | * @ingroup ClassicTasks | |
6 | */ | |
7 | ||
8 | /* | |
[3a638ce] | 9 | * COPYRIGHT (c) 1989-2014. |
[c4d69e2] | 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 | |
[c499856] | 14 | * http://www.rtems.org/license/LICENSE. |
[c4d69e2] | 15 | */ |
16 | ||
[1095ec1] | 17 | #if HAVE_CONFIG_H |
18 | #include "config.h" | |
19 | #endif | |
20 | ||
[5618c37a] | 21 | #include <rtems/rtems/tasks.h> |
22 | #include <rtems/score/threadimpl.h> | |
[c4d69e2] | 23 | |
24 | rtems_status_code rtems_task_restart( | |
[d3b72ca3] | 25 | rtems_id id, |
26 | uint32_t argument | |
[c4d69e2] | 27 | ) |
28 | { | |
[9388390] | 29 | Thread_Control *the_thread; |
30 | ISR_lock_Context lock_context; | |
31 | Thread_Entry_information entry; | |
32 | bool ok; | |
[ebe61382] | 33 | |
[e266d13] | 34 | the_thread = _Thread_Get( id, &lock_context ); |
[9388390] | 35 | |
36 | if ( the_thread == NULL ) { | |
[ebe61382] | 37 | #if defined(RTEMS_MULTIPROCESSING) |
[9388390] | 38 | if ( _Thread_MP_Is_remote( id ) ) { |
[ebe61382] | 39 | return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; |
[9388390] | 40 | } |
[ebe61382] | 41 | #endif |
42 | ||
[9388390] | 43 | return RTEMS_INVALID_ID; |
[c4d69e2] | 44 | } |
45 | ||
[9388390] | 46 | entry = the_thread->Start.Entry; |
47 | entry.Kinds.Numeric.argument = argument; | |
48 | ||
49 | if ( the_thread == _Thread_Executing ) { | |
50 | _Thread_Restart_self( the_thread, &entry, &lock_context ); | |
51 | RTEMS_UNREACHABLE(); | |
52 | } | |
53 | ||
54 | ok = _Thread_Restart_other( the_thread, &entry, &lock_context ); | |
55 | ||
56 | return ok ? RTEMS_SUCCESSFUL : RTEMS_INCORRECT_STATE; | |
[c4d69e2] | 57 | } |
Note: See TracBrowser
for help on using the repository browser.