From cb1b853d0b494d5d3d3029a6432dffbe07fa1c4e Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 18 Jun 1998 19:01:57 +0000 Subject: All task delete API level services were incorrectly assuming that the task to be deleted was created via the same API (i.e. were of the object class created by this API). For example, a POSIX thread calling the rtems_task_delete(SELF) directive would incorrectly update the RTEMS object local pointer table. Jennifer discovered this when moving tests implemented in C using the Classic RTEMS API into a tree of Ada tests. The Ada tests were implicitly using POSIX services. This lead to some unexpected behavior. --- c/src/exec/rtems/src/tasks.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'c/src/exec/rtems') diff --git a/c/src/exec/rtems/src/tasks.c b/c/src/exec/rtems/src/tasks.c index 3d76782ce1..81955cd305 100644 --- a/c/src/exec/rtems/src/tasks.c +++ b/c/src/exec/rtems/src/tasks.c @@ -555,6 +555,7 @@ rtems_status_code rtems_task_delete( { register Thread_Control *the_thread; Objects_Locations location; + Objects_Information *the_information; the_thread = _Thread_Get( id, &location ); switch ( location ) { @@ -564,7 +565,15 @@ rtems_status_code rtems_task_delete( _Thread_Dispatch(); return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; case OBJECTS_LOCAL: - _Thread_Close( &_RTEMS_tasks_Information, the_thread ); + the_information = _Objects_Get_information( the_thread->Object.id ); + + if ( !the_information ) { + _Thread_Enable_dispatch(); + return RTEMS_INVALID_ID; + /* This should never happen if _Thread_Get() works right */ + } + + _Thread_Close( the_information, the_thread ); _RTEMS_tasks_Free( the_thread ); -- cgit v1.2.3