5
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 | bool _Scheduler_Set_affinity( |
---|
22 | Thread_Control *the_thread, |
---|
23 | size_t cpusetsize, |
---|
24 | const cpu_set_t *cpuset |
---|
25 | ) |
---|
26 | { |
---|
27 | const Scheduler_Control *scheduler; |
---|
28 | ISR_lock_Context lock_context; |
---|
29 | bool ok; |
---|
30 | |
---|
31 | if ( !_CPU_set_Is_large_enough( cpusetsize ) ) { |
---|
32 | return false; |
---|
33 | } |
---|
34 | |
---|
35 | scheduler = _Thread_Scheduler_get_home( the_thread ); |
---|
36 | _Scheduler_Acquire_critical( scheduler, &lock_context ); |
---|
37 | |
---|
38 | #if defined(RTEMS_SMP) |
---|
39 | ok = ( *scheduler->Operations.set_affinity )( |
---|
40 | scheduler, |
---|
41 | the_thread, |
---|
42 | cpusetsize, |
---|
43 | cpuset |
---|
44 | ); |
---|
45 | #else |
---|
46 | ok = _Scheduler_default_Set_affinity_body( |
---|
47 | scheduler, |
---|
48 | the_thread, |
---|
49 | cpusetsize, |
---|
50 | cpuset |
---|
51 | ); |
---|
52 | #endif |
---|
53 | |
---|
54 | _Scheduler_Release_critical( scheduler, &lock_context ); |
---|
55 | return ok; |
---|
56 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.