summaryrefslogtreecommitdiffstats
path: root/cpukit/posix
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-03 15:03:35 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-04 11:01:18 +0200
commit24934e36e2513f972510d7c746103be1f766dc6a (patch)
tree66e3c8840cec6c1262f142e25ec545926140dbf9 /cpukit/posix
parentscore: Add and use Scheduler_simple_Control (diff)
downloadrtems-24934e36e2513f972510d7c746103be1f766dc6a.tar.bz2
score: Add scheduler control to scheduler ops
Scheduler operations must be free of a global scheduler context to enable partitioned/clustered scheduling.
Diffstat (limited to 'cpukit/posix')
-rw-r--r--cpukit/posix/src/nanosleep.c2
-rw-r--r--cpukit/posix/src/pthreadcreate.c1
-rw-r--r--cpukit/posix/src/pthreadgetaffinitynp.c12
-rw-r--r--cpukit/posix/src/pthreadsetaffinitynp.c17
-rw-r--r--cpukit/posix/src/sched_yield.c5
5 files changed, 23 insertions, 14 deletions
diff --git a/cpukit/posix/src/nanosleep.c b/cpukit/posix/src/nanosleep.c
index 52fcc96d6e..ebaef33b26 100644
--- a/cpukit/posix/src/nanosleep.c
+++ b/cpukit/posix/src/nanosleep.c
@@ -65,7 +65,7 @@ int nanosleep(
if ( !ticks ) {
_Thread_Disable_dispatch();
executing = _Thread_Executing;
- _Scheduler_Yield( executing );
+ _Scheduler_Yield( _Scheduler_Get( executing ), executing );
_Thread_Enable_dispatch();
if ( rmtp ) {
rmtp->tv_sec = 0;
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c
index 8ae790480b..f85e1efcfd 100644
--- a/cpukit/posix/src/pthreadcreate.c
+++ b/cpukit/posix/src/pthreadcreate.c
@@ -194,6 +194,7 @@ int pthread_create(
#if defined(RTEMS_SMP) && __RTEMS_HAVE_SYS_CPUSET_H__
status = _Scheduler_Set_affinity(
+ _Scheduler_Get( the_thread ),
the_thread,
the_attr->affinitysetsize,
the_attr->affinityset
diff --git a/cpukit/posix/src/pthreadgetaffinitynp.c b/cpukit/posix/src/pthreadgetaffinitynp.c
index 497236f60f..41b8d30be2 100644
--- a/cpukit/posix/src/pthreadgetaffinitynp.c
+++ b/cpukit/posix/src/pthreadgetaffinitynp.c
@@ -47,12 +47,14 @@ int pthread_getaffinity_np(
switch ( location ) {
case OBJECTS_LOCAL:
- ok = _Scheduler_Get_affinity( the_thread, cpusetsize, cpuset );
+ ok = _Scheduler_Get_affinity(
+ _Scheduler_Get( the_thread ),
+ the_thread,
+ cpusetsize,
+ cpuset
+ );
_Objects_Put( &the_thread->Object );
- if (!ok)
- return EINVAL;
- return 0;
- break;
+ return ok ? 0 : EINVAL;
#if defined(RTEMS_MULTIPROCESSING)
case OBJECTS_REMOTE:
diff --git a/cpukit/posix/src/pthreadsetaffinitynp.c b/cpukit/posix/src/pthreadsetaffinitynp.c
index d150b409a1..d9df75b8de 100644
--- a/cpukit/posix/src/pthreadsetaffinitynp.c
+++ b/cpukit/posix/src/pthreadsetaffinitynp.c
@@ -47,15 +47,18 @@ int pthread_setaffinity_np(
switch ( location ) {
case OBJECTS_LOCAL:
- api = the_thread->API_Extensions[ THREAD_API_POSIX ];
- ok = _Scheduler_Set_affinity( the_thread, cpusetsize, cpuset );
- if (ok)
+ ok = _Scheduler_Set_affinity(
+ _Scheduler_Get( the_thread ),
+ the_thread,
+ cpusetsize,
+ cpuset
+ );
+ if ( ok ) {
+ api = the_thread->API_Extensions[ THREAD_API_POSIX ];
CPU_COPY( api->Attributes.affinityset, cpuset );
+ }
_Objects_Put( &the_thread->Object );
- if (!ok)
- return EINVAL;
- return 0;
- break;
+ return ok ? 0 : EINVAL;
#if defined(RTEMS_MULTIPROCESSING)
case OBJECTS_REMOTE:
diff --git a/cpukit/posix/src/sched_yield.c b/cpukit/posix/src/sched_yield.c
index 906d102a37..5293b199dc 100644
--- a/cpukit/posix/src/sched_yield.c
+++ b/cpukit/posix/src/sched_yield.c
@@ -26,8 +26,11 @@
int sched_yield( void )
{
+ Thread_Control *executing;
+
_Thread_Disable_dispatch();
- _Scheduler_Yield( _Thread_Executing );
+ executing = _Thread_Executing;
+ _Scheduler_Yield( _Scheduler_Get( executing ), executing );
_Thread_Enable_dispatch();
return 0;
}