source: rtems/cpukit/rtems/src/taskgetscheduler.c @ 66cb142

5
Last change on this file since 66cb142 was 2dd098a, checked in by Sebastian Huber <sebastian.huber@…>, on 10/31/16 at 07:33:11

score: Introduce Thread_Scheduler_control::home

Replace Thread_Scheduler_control::control and
Thread_Scheduler_control::own_control with new
Thread_Scheduler_control::home.

Update #2556.

  • 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  Thread_Control          *the_thread;
28  ISR_lock_Context         lock_context;
29  const Scheduler_Control *scheduler;
30
31  if ( scheduler_id == NULL ) {
32    return RTEMS_INVALID_ADDRESS;
33  }
34
35  the_thread = _Thread_Get( task_id, &lock_context );
36
37  if ( the_thread == NULL ) {
38#if defined(RTEMS_MULTIPROCESSING)
39    if ( _Thread_MP_Is_remote( task_id ) ) {
40      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
41    }
42#endif
43
44    return RTEMS_INVALID_ID;
45  }
46
47  _Thread_State_acquire_critical( the_thread, &lock_context );
48
49  scheduler = _Thread_Scheduler_get_home( the_thread );
50  *scheduler_id = _Scheduler_Build_id( _Scheduler_Get_index( scheduler ) );
51
52  _Thread_State_release( the_thread, &lock_context );
53  return RTEMS_SUCCESSFUL;
54}
Note: See TracBrowser for help on using the repository browser.