source: rtems/cpukit/rtems/src/schedulerident.c @ 2612a0b

5
Last change on this file since 2612a0b was 2612a0b, checked in by Sebastian Huber <sebastian.huber@…>, on 11/02/16 at 05:36:13

score: Simplify _Scheduler_Get_by_id()

Avoid dead code in non-SMP configurations. Return scheduler identifier
independent of the current processor count of the scheduler via
rtems_scheduler_ident(), since this value may change during run-time.
Check the processor count in _Scheduler_Set() under scheduler lock
protection.

Update #2797.

  • Property mode set to 100644
File size: 984 bytes
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_scheduler_ident(
23  rtems_name  name,
24  rtems_id   *id
25)
26{
27  rtems_status_code sc;
28
29  if ( id != NULL ) {
30    size_t n = _Scheduler_Count;
31    size_t i;
32
33    sc = RTEMS_INVALID_NAME;
34
35    for ( i = 0 ; i < n && sc == RTEMS_INVALID_NAME ; ++i ) {
36      const Scheduler_Control *scheduler = &_Scheduler_Table[ i ];
37
38      if ( scheduler->name == name ) {
39        *id = _Scheduler_Build_id( i );
40        sc = RTEMS_SUCCESSFUL;
41      }
42    }
43  } else {
44    sc = RTEMS_INVALID_ADDRESS;
45  }
46
47  return sc;
48}
Note: See TracBrowser for help on using the repository browser.