source: rtems/cpukit/rtems/src/taskrestart.c @ 57be57c7

Last change on this file since 57be57c7 was 57be57c7, checked in by Sebastian Huber <sebastian.huber@…>, on May 14, 2021 at 7:31:47 AM

score: Return status in _Thread_Restart_other()

This simplifies rtems_task_restart().

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup RTEMSImplClassicTask
5 *
6 * @brief This source file contains the implementation of
7 *   rtems_task_restart().
8 */
9
10/*
11 *  COPYRIGHT (c) 1989-2014.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.org/license/LICENSE.
17 */
18
19#ifdef HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include <rtems/rtems/tasks.h>
24#include <rtems/rtems/statusimpl.h>
25#include <rtems/score/threadimpl.h>
26
27rtems_status_code rtems_task_restart(
28  rtems_id            id,
29  rtems_task_argument argument
30)
31{
32  Thread_Control           *the_thread;
33  ISR_lock_Context          lock_context;
34  Thread_Entry_information  entry;
35  Status_Control            status;
36
37  the_thread = _Thread_Get( id, &lock_context );
38
39  if ( the_thread == NULL ) {
40#if defined(RTEMS_MULTIPROCESSING)
41    if ( _Thread_MP_Is_remote( id ) ) {
42      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
43    }
44#endif
45
46    return RTEMS_INVALID_ID;
47  }
48
49  entry = the_thread->Start.Entry;
50  entry.Kinds.Numeric.argument = argument;
51
52  if ( the_thread == _Thread_Executing ) {
53    _Thread_Restart_self( the_thread, &entry, &lock_context );
54    RTEMS_UNREACHABLE();
55  }
56
57  status = _Thread_Restart_other( the_thread, &entry, &lock_context );
58
59  return _Status_Get( status );
60}
Note: See TracBrowser for help on using the repository browser.