source: rtems/c/src/exec/rtems/src/taskrestart.c @ cf1f72e

4.104.114.84.95
Last change on this file since cf1f72e was 08311cc3, checked in by Joel Sherrill <joel.sherrill@…>, on 11/17/99 at 17:51:34

Updated copyright notice.

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*
2 *  RTEMS Task Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14
15#include <rtems/system.h>
16#include <rtems/rtems/status.h>
17#include <rtems/rtems/support.h>
18#include <rtems/rtems/modes.h>
19#include <rtems/score/object.h>
20#include <rtems/score/stack.h>
21#include <rtems/score/states.h>
22#include <rtems/rtems/tasks.h>
23#include <rtems/score/thread.h>
24#include <rtems/score/threadq.h>
25#include <rtems/score/tod.h>
26#include <rtems/score/userext.h>
27#include <rtems/score/wkspace.h>
28#include <rtems/score/apiext.h>
29#include <rtems/score/sysstate.h>
30
31/*PAGE
32 *
33 *  rtems_task_restart
34 *
35 *  This directive readies the specified thread.  It restores
36 *  the thread environment to the original values established
37 *  at thread creation and start time.  A thread can be restarted
38 *  from any state except the dormant state.
39 *
40 *  Input parameters:
41 *    id       - thread id
42 *    argument - thread argument
43 *
44 *  Output parameters:
45 *    RTEMS_SUCCESSFUL - if successful
46 *    error code        - if unsuccessful
47 */
48
49rtems_status_code rtems_task_restart(
50  Objects_Id id,
51  unsigned32 argument
52)
53{
54  register Thread_Control *the_thread;
55  Objects_Locations        location;
56
57  the_thread = _Thread_Get( id, &location );
58  switch ( location ) {
59
60    case OBJECTS_REMOTE:
61#if defined(RTEMS_MULTIPROCESSING)
62      _Thread_Dispatch();
63      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
64#endif
65
66    case OBJECTS_ERROR:
67      return RTEMS_INVALID_ID;
68
69    case OBJECTS_LOCAL:
70      if ( _Thread_Restart( the_thread, NULL, argument ) ) {
71        _Thread_Enable_dispatch();
72        return RTEMS_SUCCESSFUL;
73      }
74      _Thread_Enable_dispatch();
75      return RTEMS_INCORRECT_STATE;
76  }
77
78  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
79}
Note: See TracBrowser for help on using the repository browser.