RTEMS
taskrestart.c
Go to the documentation of this file.
1 
8 /*
9  * COPYRIGHT (c) 1989-2014.
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.org/license/LICENSE.
15  */
16 
17 #ifdef HAVE_CONFIG_H
18 #include "config.h"
19 #endif
20 
21 #include <rtems/rtems/tasks.h>
22 #include <rtems/score/threadimpl.h>
23 
25  rtems_id id,
26  rtems_task_argument argument
27 )
28 {
29  Thread_Control *the_thread;
30  ISR_lock_Context lock_context;
32  bool ok;
33 
34  the_thread = _Thread_Get( id, &lock_context );
35 
36  if ( the_thread == NULL ) {
37 #if defined(RTEMS_MULTIPROCESSING)
38  if ( _Thread_MP_Is_remote( id ) ) {
40  }
41 #endif
42 
43  return RTEMS_INVALID_ID;
44  }
45 
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 );
52  }
53 
54  ok = _Thread_Restart_other( the_thread, &entry, &lock_context );
55 
57 }
Thread entry information.
Definition: thread.h:130
Thread_Start_information Start
Definition: thread.h:825
Thread_Entry_information Entry
Definition: thread.h:180
Thread_Control * _Thread_Get(Objects_Id id, ISR_lock_Context *lock_context)
Gets a thread by its identifier.
Definition: threadget.c:24
CPU_Uint32ptr rtems_task_argument
This type is used to represent task argument values.
Definition: tasks.h:115
This status code indicates successful completion.
Definition: status.h:86
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
This status code indicates that an object was in wrong state for the requested operation.
Definition: status.h:160
This header file defines the main parts of the Tasks Manager API.
void _Thread_Restart_self(Thread_Control *executing, const Thread_Entry_information *entry, ISR_lock_Context *lock_context) RTEMS_NO_RETURN
Restarts the currently executing thread.
This status code indicates that an object identifier was invalid.
Definition: status.h:106
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
rtems_status_code rtems_task_restart(rtems_id id, rtems_task_argument argument)
%
Definition: taskrestart.c:24
This status code indicates that the operation was illegal on a remote object.
Definition: status.h:177
Inlined Routines from the Thread Handler.
union Thread_Entry_information::@25 Kinds
Thread entry data used by the adaptor to call the thread entry function with the right parameters...
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
#define RTEMS_UNREACHABLE()
Tells the compiler that this program point is unreachable.
Definition: basedefs.h:860
bool _Thread_Restart_other(Thread_Control *the_thread, const Thread_Entry_information *entry, ISR_lock_Context *lock_context)
Restarts the thread.