summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/schedulersetaffinity.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/score/src/schedulersetaffinity.c')
-rw-r--r--cpukit/score/src/schedulersetaffinity.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/cpukit/score/src/schedulersetaffinity.c b/cpukit/score/src/schedulersetaffinity.c
index 67073dffd1..93ed851b9e 100644
--- a/cpukit/score/src/schedulersetaffinity.c
+++ b/cpukit/score/src/schedulersetaffinity.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2014, 2017 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
@@ -19,16 +19,19 @@
#include <rtems/score/schedulerimpl.h>
bool _Scheduler_Set_affinity(
- Thread_Control *the_thread,
- size_t cpusetsize,
- const cpu_set_t *cpuset
+ Thread_Control *the_thread,
+ size_t cpusetsize,
+ const cpu_set_t *cpuset
)
{
- const Scheduler_Control *scheduler;
- ISR_lock_Context lock_context;
- bool ok;
+ Processor_mask affinity;
+ Processor_mask_Copy_status status;
+ const Scheduler_Control *scheduler;
+ ISR_lock_Context lock_context;
+ bool ok;
- if ( !_CPU_set_Is_large_enough( cpusetsize ) ) {
+ status = _Processor_mask_From_cpu_set_t( &affinity, cpusetsize, cpuset );
+ if ( !_Processor_mask_Is_at_most_partial_loss( status ) ) {
return false;
}
@@ -39,15 +42,17 @@ bool _Scheduler_Set_affinity(
ok = ( *scheduler->Operations.set_affinity )(
scheduler,
the_thread,
- cpusetsize,
- cpuset
+ &affinity
);
+
+ if ( ok ) {
+ _Processor_mask_Assign( &the_thread->Scheduler.Affinity, &affinity );
+ }
#else
ok = _Scheduler_default_Set_affinity_body(
scheduler,
the_thread,
- cpusetsize,
- cpuset
+ &affinity
);
#endif