source: rtems/cpukit/score/src/schedulergetaffinity.c @ d9952999

5
Last change on this file since d9952999 was d9952999, checked in by Sebastian Huber <sebastian.huber@…>, on 05/11/16 at 09:06:51

score: Avoid Giant lock _Scheduler_Get_affinity()

Update #2555.

  • Property mode set to 100644
File size: 1.2 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/score/schedulerimpl.h>
20
21#if defined(__RTEMS_HAVE_SYS_CPUSET_H__)
22
23bool _Scheduler_Get_affinity(
24  Thread_Control *the_thread,
25  size_t          cpusetsize,
26  cpu_set_t      *cpuset
27)
28{
29  const Scheduler_Control *scheduler;
30  ISR_lock_Context         lock_context;
31  bool                     ok;
32
33  if ( !_CPU_set_Is_large_enough( cpusetsize ) ) {
34    return false;
35  }
36
37  scheduler = _Scheduler_Get( the_thread );
38  _Scheduler_Acquire_critical( scheduler, &lock_context );
39
40#if defined(RTEMS_SMP)
41  ok = ( *scheduler->Operations.get_affinity )(
42    scheduler,
43    the_thread,
44    cpusetsize,
45    cpuset
46  );
47#else
48  ok = _Scheduler_default_Get_affinity_body(
49    scheduler,
50    the_thread,
51    cpusetsize,
52    cpuset
53  );
54#endif
55
56  _Scheduler_Release_critical( scheduler, &lock_context );
57  return ok;
58}
59
60#endif /* defined(__RTEMS_HAVE_SYS_CPUSET_H__) */
Note: See TracBrowser for help on using the repository browser.