source: rtems/cpukit/rtems/src/taskgetscheduler.c @ 8bc6bf28

5
Last change on this file since 8bc6bf28 was e5274df, checked in by Sebastian Huber <sebastian.huber@…>, on 05/20/14 at 08:03:35

rtems: Clarify task set/get scheduler parameters

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#if HAVE_CONFIG_H
16  #include "config.h"
17#endif
18
19#include <rtems/rtems/tasks.h>
20#include <rtems/score/schedulerimpl.h>
21
22rtems_status_code rtems_task_get_scheduler(
23  rtems_id  task_id,
24  rtems_id *scheduler_id
25)
26{
27  rtems_status_code sc;
28
29  if ( scheduler_id != NULL ) {
30    Thread_Control          *the_thread;
31    Objects_Locations        location;
32    const Scheduler_Control *scheduler;
33
34    the_thread = _Thread_Get( task_id, &location );
35
36    switch ( location ) {
37      case OBJECTS_LOCAL:
38        scheduler = _Scheduler_Get( the_thread );
39        *scheduler_id = _Scheduler_Build_id(
40          _Scheduler_Get_index( scheduler )
41        );
42        _Objects_Put( &the_thread->Object );
43        sc = RTEMS_SUCCESSFUL;
44        break;
45#if defined(RTEMS_MULTIPROCESSING)
46      case OBJECTS_REMOTE:
47        _Thread_Dispatch();
48        sc = RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
49        break;
50#endif
51      default:
52        sc = RTEMS_INVALID_ID;
53        break;
54    }
55  } else {
56    sc = RTEMS_INVALID_ADDRESS;
57  }
58
59  return sc;
60}
Note: See TracBrowser for help on using the repository browser.