[PATCH 05/10] rtems: Move affinity from thread to scheduler.
Jennifer
jennifer.averett at oarcorp.com
Mon Mar 24 18:39:36 UTC 2014
From: Jennifer Averett <jennifer.averett at oarcorp.com>
---
cpukit/rtems/src/taskgetaffinity.c | 6 +++---
cpukit/rtems/src/tasksetaffinity.c | 6 +++++-
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/cpukit/rtems/src/taskgetaffinity.c b/cpukit/rtems/src/taskgetaffinity.c
index 041eb27..eda39e4 100644
--- a/cpukit/rtems/src/taskgetaffinity.c
+++ b/cpukit/rtems/src/taskgetaffinity.c
@@ -23,6 +23,8 @@
#include <rtems/rtems/tasks.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/cpusetimpl.h>
+#include <rtems/score/schedulerimpl.h>
+
rtems_status_code rtems_task_get_affinity(
rtems_id id,
@@ -42,10 +44,8 @@ rtems_status_code rtems_task_get_affinity(
switch ( location ) {
case OBJECTS_LOCAL:
- if ( cpusetsize != the_thread->affinity.setsize ) {
+ if ( _Scheduler_Get_affinity( the_thread, cpusetsize, cpuset ) != 0 ) {
status = RTEMS_INVALID_NUMBER;
- } else {
- CPU_COPY( cpuset, the_thread->affinity.set );
}
_Objects_Put( &the_thread->Object );
return status;
diff --git a/cpukit/rtems/src/tasksetaffinity.c b/cpukit/rtems/src/tasksetaffinity.c
index 2b40fcb..18060a2 100644
--- a/cpukit/rtems/src/tasksetaffinity.c
+++ b/cpukit/rtems/src/tasksetaffinity.c
@@ -23,6 +23,7 @@
#include <rtems/rtems/tasks.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/cpusetimpl.h>
+#include <rtems/score/schedulerimpl.h>
rtems_status_code rtems_task_set_affinity(
rtems_id id,
@@ -45,8 +46,11 @@ rtems_status_code rtems_task_set_affinity(
switch ( location ) {
case OBJECTS_LOCAL:
- CPU_COPY( the_thread->affinity.set, cpuset );
+ error = _Scheduler_Set_affinity( the_thread, cpusetsize, cpuset );
_Objects_Put( &the_thread->Object );
+ if (error) {
+ return RTEMS_INVALID_NUMBER;
+ }
return RTEMS_SUCCESSFUL;
#if defined(RTEMS_MULTIPROCESSING)
--
1.8.1.4
More information about the devel
mailing list