source: rtems/cpukit/rtems/src/taskrestart.c @ 80cf60e

5
Last change on this file since 80cf60e was 80cf60e, checked in by Sebastian Huber <sebastian.huber@…>, on 04/15/20 at 07:48:32

Canonicalize config.h include

Use the following variant which was already used by most source files:

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Task Restart
5 *  @ingroup ClassicTasks
6 */
7
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
24rtems_status_code rtems_task_restart(
25  rtems_id            id,
26  rtems_task_argument argument
27)
28{
29  Thread_Control           *the_thread;
30  ISR_lock_Context          lock_context;
31  Thread_Entry_information  entry;
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 ) ) {
39      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
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 );
51    RTEMS_UNREACHABLE();
52  }
53
54  ok = _Thread_Restart_other( the_thread, &entry, &lock_context );
55
56  return ok ? RTEMS_SUCCESSFUL : RTEMS_INCORRECT_STATE;
57}
Note: See TracBrowser for help on using the repository browser.