rtems: Move affinity from thread to scheduler.

This commit is contained in:
Jennifer Averett
2014-03-18 13:55:54 -05:00
parent 6d24e8bc6f
commit 54f345f5a5
2 changed files with 9 additions and 9 deletions

View File

@@ -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;

View File

@@ -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)