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 May 20, 2016 at 1:10:27 PM

Replace *_Get_interrupt_disable() with *_Get()

Uniformly use *_Get() to get an object by identifier with a lock
context.

  • Property mode set to 100644
File size: 1.2 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#if 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  uint32_t  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.