source: rtems/cpukit/rtems/src/taskrestart.c @ 2d2352b

4.115
Last change on this file since 2d2352b was 2d2352b, checked in by Sebastian Huber <sebastian.huber@…>, on 06/05/13 at 09:48:57

score: Add and use _Objects_Put()

Add and use _Objects_Put_without_thread_dispatch(). These two functions
pair with the _Objects_Get() function. This helps to introduce object
specific SMP locks to avoid lock contention.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Task Restart
5 *  @ingroup ClassicTasks
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
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.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/rtems/status.h>
23#include <rtems/rtems/support.h>
24#include <rtems/rtems/modes.h>
25#include <rtems/score/object.h>
26#include <rtems/score/stack.h>
27#include <rtems/score/states.h>
28#include <rtems/rtems/tasks.h>
29#include <rtems/score/thread.h>
30#include <rtems/score/threadq.h>
31#include <rtems/score/tod.h>
32#include <rtems/score/wkspace.h>
33#include <rtems/score/apiext.h>
34#include <rtems/score/sysstate.h>
35
36rtems_status_code rtems_task_restart(
37  rtems_id  id,
38  uint32_t  argument
39)
40{
41  register Thread_Control *the_thread;
42  Objects_Locations        location;
43
44  the_thread = _Thread_Get( id, &location );
45  switch ( location ) {
46
47    case OBJECTS_LOCAL:
48      if ( _Thread_Restart( the_thread, NULL, argument ) ) {
49        _Objects_Put( &the_thread->Object );
50        return RTEMS_SUCCESSFUL;
51      }
52      _Objects_Put( &the_thread->Object );
53      return RTEMS_INCORRECT_STATE;
54
55#if defined(RTEMS_MULTIPROCESSING)
56    case OBJECTS_REMOTE:
57      _Thread_Dispatch();
58      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
59#endif
60
61    case OBJECTS_ERROR:
62      break;
63  }
64
65  return RTEMS_INVALID_ID;
66}
Note: See TracBrowser for help on using the repository browser.