source: rtems/cpukit/rtems/src/taskgetscheduler.c @ 27270b0d

4.11
Last change on this file since 27270b0d was 27270b0d, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 9, 2014 at 8:09:39 AM

rtems: Add task get/set scheduler

  • 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  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( 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.