[rtems commit] rtems: Move affinity from thread to scheduler.
Jennifer Averett
jennifer at rtems.org
Thu Apr 3 16:13:11 UTC 2014
Module: rtems
Branch: master
Commit: 54f345f5a5c9160b8839d080cdfd36ee13f4dada
Changeset: http://git.rtems.org/rtems/commit/?id=54f345f5a5c9160b8839d080cdfd36ee13f4dada
Author: Jennifer Averett <jennifer.averett at oarcorp.com>
Date: Tue Mar 18 13:55:54 2014 -0500
rtems: Move affinity from thread to scheduler.
---
cpukit/rtems/src/taskgetaffinity.c | 6 +++---
cpukit/rtems/src/tasksetaffinity.c | 12 ++++++------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/cpukit/rtems/src/taskgetaffinity.c b/cpukit/rtems/src/taskgetaffinity.c
index 041eb27..d9cc25e 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 )) {
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..4d76741 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,
@@ -32,21 +33,20 @@ rtems_status_code rtems_task_set_affinity(
{
Thread_Control *the_thread;
Objects_Locations location;
- int error;
+ int ok;
if ( !cpuset )
return RTEMS_INVALID_ADDRESS;
- error = _CPU_set_Is_valid( cpuset, cpusetsize );
- if ( error != 0 )
- return RTEMS_INVALID_NUMBER;
-
the_thread = _Thread_Get( id, &location );
switch ( location ) {
case OBJECTS_LOCAL:
- CPU_COPY( the_thread->affinity.set, cpuset );
+ ok = _Scheduler_Set_affinity( the_thread, cpusetsize, cpuset );
_Objects_Put( &the_thread->Object );
+ if (! ok) {
+ return RTEMS_INVALID_NUMBER;
+ }
return RTEMS_SUCCESSFUL;
#if defined(RTEMS_MULTIPROCESSING)
More information about the vc
mailing list