5
Line | |
---|
1 | /* |
---|
2 | * Copyright (c) 2014, 2017 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 | bool _Scheduler_Get_affinity( |
---|
22 | Thread_Control *the_thread, |
---|
23 | size_t cpusetsize, |
---|
24 | cpu_set_t *cpuset |
---|
25 | ) |
---|
26 | { |
---|
27 | const Scheduler_Control *scheduler; |
---|
28 | ISR_lock_Context lock_context; |
---|
29 | const Processor_mask *affinity; |
---|
30 | Processor_mask_Copy_status status; |
---|
31 | |
---|
32 | scheduler = _Thread_Scheduler_get_home( the_thread ); |
---|
33 | _Scheduler_Acquire_critical( scheduler, &lock_context ); |
---|
34 | |
---|
35 | #if defined(RTEMS_SMP) |
---|
36 | affinity = &the_thread->Scheduler.Affinity; |
---|
37 | #else |
---|
38 | affinity = &_Processor_mask_The_one_and_only; |
---|
39 | #endif |
---|
40 | status = _Processor_mask_To_cpu_set_t( affinity, cpusetsize, cpuset ); |
---|
41 | |
---|
42 | _Scheduler_Release_critical( scheduler, &lock_context ); |
---|
43 | return status == PROCESSOR_MASK_COPY_LOSSLESS; |
---|
44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.