From 0faa9dad0768f0291cb44d8d0dcb74fd3f362cc2 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 24 Nov 2010 15:51:28 +0000 Subject: 2010-11-24 Gedare Bloom PR 1647/cpukit * posix/src/nanosleep.c, posix/src/sched_yield.c, rtems/src/taskwakeafter.c, sapi/include/confdefs.h, sapi/include/rtems/config.h, sapi/src/exinit.c, score/Makefile.am, score/preinstall.am, score/include/rtems/score/prioritybitmap.h, score/include/rtems/score/thread.h, score/inline/rtems/score/thread.inl, score/src/thread.c, score/src/threadchangepriority.c, score/src/threadclearstate.c, score/src/threadclose.c, score/src/threadinitialize.c, score/src/threadready.c, score/src/threadresume.c, score/src/threadsetpriority.c, score/src/threadsetstate.c, score/src/threadsettransient.c, score/src/threadsuspend.c, score/src/threadtickletimeslice.c: Refactor scheduler out of thread handler to facilitate alternate scheduler implementations. * score/src/threadyieldprocessor.c: Removed. * score/src/schedulerprioritythreadschedulerupdate.c, score/src/schedulerprioritythreadschedulerfree.c, score/src/schedulerpriorityblock.c, score/src/scheduler.c, score/src/schedulerprioritythreadschedulerallocate.c, score/src/schedulerpriorityunblock.c, score/src/schedulerpriority.c, score/src/schedulerpriorityyield.c, score/include/rtems/score/schedulerpriority.h, score/include/rtems/score/scheduler.h, score/inline/rtems/score/scheduler.inl, score/inline/rtems/score/schedulerpriority.inl: New files. --- cpukit/score/inline/rtems/score/scheduler.inl | 139 ++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 cpukit/score/inline/rtems/score/scheduler.inl (limited to 'cpukit/score/inline/rtems/score/scheduler.inl') diff --git a/cpukit/score/inline/rtems/score/scheduler.inl b/cpukit/score/inline/rtems/score/scheduler.inl new file mode 100644 index 0000000000..4a0f10a3f3 --- /dev/null +++ b/cpukit/score/inline/rtems/score/scheduler.inl @@ -0,0 +1,139 @@ +/** + * @file rtems/score/scheduler.inl + * + * This inline file contains all of the inlined routines associated with + * the manipulation of the scheduler. + */ + +/* + * Copyright (C) 2010 Gedare Bloom. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_SCORE_SCHEDULER_H +# error "Never use directly; include instead." +#endif + +#ifndef _RTEMS_SCORE_SCHEDULER_INL +#define _RTEMS_SCORE_SCHEDULER_INL + +/** + * @addtogroup ScoreScheduler + * @{ + */ + +/** + * The preferred method to add a new scheduler is to define the jump table + * entries and add a case to the _Scheduler_Initialize routine. + * + * Generic scheduling implementations that rely on the ready queue only can + * be found in the _Scheduler_queue_XXX functions. + * + */ + +/* Passing the Scheduler_Control* to these functions allows for multiple + * scheduler's to exist simultaneously, which could be useful on an SMP + * system. Then remote Schedulers may be accessible. How to protect such + * accesses remains an open problem. + */ + +/** @brief _Scheduler_Schedule + * + * This kernel routine implements the scheduling decision logic for + * @a the_scheduler. It does NOT dispatch. + */ +RTEMS_INLINE_ROUTINE void _Scheduler_Schedule( + Scheduler_Control *the_scheduler +) +{ + the_scheduler->operations.schedule( the_scheduler ); +} + +/** @brief _Scheduler_Yield + * + * This routine is invoked when a thread wishes to voluntarily + * transfer control of the processor to another thread. This routine + * always operates on the scheduler that 'owns' the currently executing + * thread. + */ +RTEMS_INLINE_ROUTINE void _Scheduler_Yield( void ) +{ + _Scheduler.operations.yield( &_Scheduler ); +} + +/** @brief _Scheduler_Block + * + * This routine removes @a the_thread from the scheduling decision for + * @a the_scheduler. The primary task is to remove the thread from the + * ready queue. It performs any necessary schedulering operations + * including the selection of a new heir thread. + */ +RTEMS_INLINE_ROUTINE void _Scheduler_Block( + Scheduler_Control *the_scheduler, + Thread_Control *the_thread +) +{ + the_scheduler->operations.block( the_scheduler, the_thread ); +} + +/** @brief _Scheduler_Unblock + * + * This routine adds @a the_thread to the scheduling decision for + * @a the_scheduler. The primary task is to add the thread to the + * ready queue per the schedulering policy and update any appropriate + * scheduling variables, for example the heir thread. + */ +RTEMS_INLINE_ROUTINE void _Scheduler_Unblock( + Scheduler_Control *the_scheduler, + Thread_Control *the_thread +) +{ + the_scheduler->operations.unblock( the_scheduler, the_thread ); +} + +/** @brief _Scheduler_Thread_scheduler_allocate + * + * This routine allocates @a the_thread->scheduler + */ +RTEMS_INLINE_ROUTINE void* _Scheduler_Thread_scheduler_allocate( + Scheduler_Control *the_scheduler, + Thread_Control *the_thread +) +{ + return + the_scheduler->operations.scheduler_allocate( the_scheduler, the_thread ); +} + +/** @brief _Scheduler_Thread_scheduler_free + * + * This routine frees @a the_thread->scheduler + */ +RTEMS_INLINE_ROUTINE void _Scheduler_Thread_scheduler_free( + Scheduler_Control *the_scheduler, + Thread_Control *the_thread +) +{ + return the_scheduler->operations.scheduler_free( the_scheduler, the_thread ); +} + +/** @brief _Scheduler_Thread_scheduler_update + * + * This routine updates @a the_thread->scheduler + */ +RTEMS_INLINE_ROUTINE void _Scheduler_Thread_scheduler_update( + Scheduler_Control *the_scheduler, + Thread_Control *the_thread +) +{ + the_scheduler->operations.scheduler_update( the_scheduler, the_thread ); +} + +/**@}*/ + +#endif +/* end of include file */ -- cgit v1.2.3