source: rtems/cpukit/score/src/schedulersetaffinity.c @ 2dd098a

5
Last change on this file since 2dd098a 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.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_Set_affinity(
24  Thread_Control  *the_thread,
25  size_t           cpusetsize,
26  const 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 = _Thread_Scheduler_get_home( the_thread );
38  _Scheduler_Acquire_critical( scheduler, &lock_context );
39
40#if defined(RTEMS_SMP)
41  ok = ( *scheduler->Operations.set_affinity )(
42    scheduler,
43    the_thread,
44    cpusetsize,
45    cpuset
46  );
47#else
48  ok = _Scheduler_default_Set_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.