From 5250ff39f042c09503b61eb81a2c705e9b06b917 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 23 Aug 1995 21:06:31 +0000 Subject: Moved _Thread_Information -> _RTEMS_tasks_Information. Added a table of object information control blocks. Modified _Thread_Get so it looks up a thread regardless of which thread management "entity" (manager, internal, etc) actually "owns" it. --- cpukit/score/src/thread.c | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) (limited to 'cpukit/score/src/thread.c') diff --git a/cpukit/score/src/thread.c b/cpukit/score/src/thread.c index 9793792b44..c4dde3e6f8 100644 --- a/cpukit/score/src/thread.c +++ b/cpukit/score/src/thread.c @@ -35,14 +35,13 @@ * This routine initializes all thread manager related data structures. * * Input parameters: - * maximum_tasks - number of tasks to initialize * ticks_per_timeslice - clock ticks per quantum + * maximum_proxies - number of proxies to initialize * * Output parameters: NONE */ void _Thread_Handler_initialization( - unsigned32 maximum_tasks, unsigned32 ticks_per_timeslice, unsigned32 maximum_proxies ) @@ -57,16 +56,6 @@ void _Thread_Handler_initialization( _Thread_Ticks_remaining_in_timeslice = ticks_per_timeslice; _Thread_Ticks_per_timeslice = ticks_per_timeslice; - _Objects_Initialize_information( - &_Thread_Information, - OBJECTS_RTEMS_TASKS, - TRUE, - maximum_tasks, - sizeof( Thread_Control ), - FALSE, - RTEMS_MAXIMUM_NAME_LENGTH - ); - _Thread_Ready_chain = _Workspace_Allocate_or_fatal_error( (RTEMS_MAXIMUM_PRIORITY + 1) * sizeof(Chain_Control) ); @@ -789,22 +778,40 @@ boolean _Thread_Change_mode( * * NOTE: If we are not using static inlines, this must be a real * subroutine call. + * + * NOTE: XXX... This routine may be able to be optimized. */ #ifndef USE_INLINES STATIC INLINE Thread_Control *_Thread_Get ( - Objects_Id id, - Objects_Locations *location + Objects_Id id, + Objects_Locations *location ) { + Objects_Classes the_class; + Objects_Information *information; + if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) { - _Thread_Disable_dispatch(); - *location = OBJECTS_LOCAL; - return( _Thread_Executing ); + _Thread_Disable_dispatch(); + *location = OBJECTS_LOCAL; + return( _Thread_Executing ); } - - return (Thread_Control *) _Objects_Get( &_Thread_Information, id, location ); + + the_class = rtems_get_class( id ); + + if ( the_class > OBJECTS_CLASSES_LAST ) { + *location = OBJECTS_ERROR; + return (Thread_Control *) 0; + } + + information = _Objects_Information_table[ the_class ]; + + if ( !information || !information->is_thread ) { + *location = OBJECTS_ERROR; + return (Thread_Control *) 0; + } + + return (Thread_Control *) _Objects_Get( information, id, location ); } #endif - -- cgit v1.2.3