summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-05-22 20:38:03 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-05-22 20:38:03 +0000
commit345fc11da9dcad5faa23f9888c8f3a0260e8ad45 (patch)
tree561c791f8d6342c00391dea6c1dd47f08ac82612 /cpukit
parent2008-05-22 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-345fc11da9dcad5faa23f9888c8f3a0260e8ad45.tar.bz2
2008-05-22 Joel Sherrill <joel.sherrill@oarcorp.com>
* itron/include/rtems/itron/task.h, itron/src/del_tsk.c, itron/src/exd_tsk.c, itron/src/task.c, posix/include/rtems/posix/threadsup.h, posix/src/cancel.c, posix/src/cancelrun.c, posix/src/pthread.c, posix/src/pthreadexit.c, posix/src/setcancelstate.c, posix/src/setcanceltype.c, posix/src/testcancel.c, rtems/src/taskdelete.c, score/inline/rtems/score/object.inl, score/src/objectclose.c, score/src/threadclose.c: Make all task delete/exit/cancel routines follow the same critical section pattern. Also ensure that POSIX cancelation routines are run at thread exit.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/ChangeLog13
-rw-r--r--cpukit/itron/include/rtems/itron/task.h9
-rw-r--r--cpukit/itron/src/del_tsk.c22
-rw-r--r--cpukit/itron/src/exd_tsk.c14
-rw-r--r--cpukit/itron/src/task.c24
-rw-r--r--cpukit/posix/include/rtems/posix/threadsup.h49
-rw-r--r--cpukit/posix/src/cancel.c16
-rw-r--r--cpukit/posix/src/cancelrun.c16
-rw-r--r--cpukit/posix/src/pthread.c7
-rw-r--r--cpukit/posix/src/pthreadexit.c34
-rw-r--r--cpukit/posix/src/setcancelstate.c11
-rw-r--r--cpukit/posix/src/setcanceltype.c9
-rw-r--r--cpukit/posix/src/testcancel.c10
-rw-r--r--cpukit/rtems/src/taskdelete.c38
-rw-r--r--cpukit/score/inline/rtems/score/object.inl26
-rw-r--r--cpukit/score/src/objectclose.c6
-rw-r--r--cpukit/score/src/threadclose.c11
17 files changed, 201 insertions, 114 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index 3ece903160..3e915de78f 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,5 +1,18 @@
2008-05-22 Joel Sherrill <joel.sherrill@oarcorp.com>
+ * itron/include/rtems/itron/task.h, itron/src/del_tsk.c,
+ itron/src/exd_tsk.c, itron/src/task.c,
+ posix/include/rtems/posix/threadsup.h, posix/src/cancel.c,
+ posix/src/cancelrun.c, posix/src/pthread.c, posix/src/pthreadexit.c,
+ posix/src/setcancelstate.c, posix/src/setcanceltype.c,
+ posix/src/testcancel.c, rtems/src/taskdelete.c,
+ score/inline/rtems/score/object.inl, score/src/objectclose.c,
+ score/src/threadclose.c: Make all task delete/exit/cancel routines
+ follow the same critical section pattern. Also ensure that POSIX
+ cancelation routines are run at thread exit.
+
+2008-05-22 Joel Sherrill <joel.sherrill@oarcorp.com>
+
* libcsupport/src/termios_baud2index.c,
libcsupport/src/termios_baud2num.c,
libcsupport/src/termios_num2baud.c,
diff --git a/cpukit/itron/include/rtems/itron/task.h b/cpukit/itron/include/rtems/itron/task.h
index e136c5719f..34b424823e 100644
--- a/cpukit/itron/include/rtems/itron/task.h
+++ b/cpukit/itron/include/rtems/itron/task.h
@@ -76,15 +76,6 @@ void _ITRON_Task_Manager_initialization(
);
/*
- *
- * _ITRON_Delete_task
- */
-
-ER _ITRON_Delete_task(
- Thread_Control *the_thread
-);
-
-/*
* Return a status code and enable dispatching
*/
diff --git a/cpukit/itron/src/del_tsk.c b/cpukit/itron/src/del_tsk.c
index b388602114..e7ed9442ff 100644
--- a/cpukit/itron/src/del_tsk.c
+++ b/cpukit/itron/src/del_tsk.c
@@ -1,5 +1,5 @@
/*
- * COPYRIGHT (c) 1989-2007.
+ * COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -19,6 +19,7 @@
#include <rtems/score/userext.h>
#include <rtems/score/wkspace.h>
#include <rtems/score/apiext.h>
+#include <rtems/score/apimutex.h>
#include <rtems/score/sysstate.h>
#include <rtems/itron/task.h>
@@ -34,25 +35,38 @@ ER del_tsk(
{
register Thread_Control *the_thread;
Objects_Locations location;
+ Objects_Information *the_information;
ER result = E_OK; /* to avoid warning */
+ _RTEMS_Lock_allocator();
the_thread = _ITRON_Task_Get( tskid, &location );
switch ( location ) {
#if defined(RTEMS_MULTIPROCESSING)
case OBJECTS_REMOTE:
#endif
case OBJECTS_ERROR:
+ _RTEMS_Unlock_allocator();
return _ITRON_Task_Clarify_get_id_error( tskid );
case OBJECTS_LOCAL:
- if ( _Thread_Is_executing( the_thread ) )
+ if ( _Thread_Is_executing( the_thread ) ) {
+ _RTEMS_Unlock_allocator();
_ITRON_return_errorno( E_OBJ );
+ }
- if ( !_States_Is_dormant( the_thread->current_state ) )
+ if ( !_States_Is_dormant( the_thread->current_state ) ) {
+ _RTEMS_Unlock_allocator();
_ITRON_return_errorno( E_OBJ );
+ }
- result = _ITRON_Delete_task( the_thread );
+ the_information = _Objects_Get_information_id( the_thread->Object.id );
+ _Thread_Close( the_information, the_thread );
+
+ _ITRON_Task_Free( the_thread );
+
+ _RTEMS_Unlock_allocator();
+ result = E_OK;
break;
}
diff --git a/cpukit/itron/src/exd_tsk.c b/cpukit/itron/src/exd_tsk.c
index 1cae344a53..41fa520ec5 100644
--- a/cpukit/itron/src/exd_tsk.c
+++ b/cpukit/itron/src/exd_tsk.c
@@ -20,6 +20,7 @@
#include <rtems/score/userext.h>
#include <rtems/score/wkspace.h>
#include <rtems/score/apiext.h>
+#include <rtems/score/apimutex.h>
#include <rtems/score/sysstate.h>
#include <rtems/itron/task.h>
@@ -32,15 +33,18 @@ void exd_tsk( void )
{
Objects_Information *the_information;
+ _RTEMS_Lock_allocator();
_Thread_Disable_dispatch();
- the_information = _Objects_Get_information_id( _Thread_Executing->Object.id );
+ the_information = _Objects_Get_information_id(_Thread_Executing->Object.id);
- /* This should never happen if _Thread_Get() works right */
- assert( the_information );
+ /* This should never happen if _Thread_Get() works right */
+ assert( the_information );
- _Thread_Set_state( _Thread_Executing, STATES_DORMANT );
- _ITRON_Delete_task( _Thread_Executing );
+ _Thread_Close( the_information, _Thread_Executing );
+ _ITRON_Task_Free( _Thread_Executing );
+
+ _RTEMS_Unlock_allocator();
_Thread_Enable_dispatch();
}
diff --git a/cpukit/itron/src/task.c b/cpukit/itron/src/task.c
index eba7450b94..3a832bead4 100644
--- a/cpukit/itron/src/task.c
+++ b/cpukit/itron/src/task.c
@@ -19,6 +19,7 @@
#include <rtems/score/userext.h>
#include <rtems/score/wkspace.h>
#include <rtems/score/apiext.h>
+#include <rtems/score/apimutex.h>
#include <rtems/score/sysstate.h>
#include <rtems/itron/task.h>
@@ -84,29 +85,6 @@ void _ITRON_Task_Initialize_user_tasks( void )
(*_ITRON_Initialize_user_tasks_p)();
}
-/*PAGE
- *
- * _ITRON_Delete_task
- */
-
-ER _ITRON_Delete_task(
- Thread_Control *the_thread
-)
-{
- Objects_Information *the_information;
-
- the_information = _Objects_Get_information_id( the_thread->Object.id );
- if ( !the_information ) {
- return E_OBJ; /* XXX - should never happen */
- }
-
- _Thread_Close( the_information, the_thread );
-
- _ITRON_Task_Free( the_thread );
-
- return E_OK;
-}
-
/*
* At this point in time, the ITRON API does not need any other
* extensions. See the POSIX and RTEMS API extensions for
diff --git a/cpukit/posix/include/rtems/posix/threadsup.h b/cpukit/posix/include/rtems/posix/threadsup.h
index a9e2b97ee0..e0d5ce9132 100644
--- a/cpukit/posix/include/rtems/posix/threadsup.h
+++ b/cpukit/posix/include/rtems/posix/threadsup.h
@@ -3,7 +3,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2007.
+ * COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -20,27 +20,68 @@
#include <rtems/score/coresem.h>
#include <rtems/score/tqdata.h>
+/*!
+ * This defines the POSIX API support structure associated with
+ * each thread in a system with POSIX configured.
+ */
typedef struct {
+ /** This is the POSIX threads attribute set. */
pthread_attr_t Attributes;
+ /** This indicates whether the thread is attached or detached. */
int detachstate;
+ /** This is the set of threads waiting for the thread to exit. */
Thread_queue_Control Join_List;
+ /** This is the thread's current scheduling policy. */
int schedpolicy;
+ /** This is the thread's current set of scheduling parameters. */
struct sched_param schedparam;
+ /**
+ * This is the high priority to execute at when using the sporadic
+ * scheduler.
+ */
int ss_high_priority;
+ /**
+ * This is the timer which controls when the thread executes at
+ * high and low priority when using the sporadic scheduler.
+ */
Watchdog_Control Sporadic_timer;
+ /** This is the set of signals which are currently blocked. */
sigset_t signals_blocked;
+ /** This is the set of signals which are currently pending. */
sigset_t signals_pending;
- /*
- * POSIX Cancelability
- */
+ /*******************************************************************/
+ /*******************************************************************/
+ /*************** POSIX Cancelability ***************/
+ /*******************************************************************/
+ /*******************************************************************/
+
+ /** This is the cancelability state. */
int cancelability_state;
+ /** This is the cancelability type. */
int cancelability_type;
+ /** This indicates if a cancelation has been requested. */
int cancelation_requested;
+ /** This is the set of cancelation handlers. */
Chain_Control Cancellation_Handlers;
} POSIX_API_Control;
+/*!
+ * @brief POSIX Thread Exit Shared Helper
+ *
+ * This method is a helper routine which ensures that all
+ * POSIX thread calls which result in a thread exiting will
+ * do so in the same manner.
+ *
+ * @param[in] the_thread is the thread exiting or being canceled
+ * @param[in] value_ptr is the value to be returned by the thread
+ */
+void _POSIX_Thread_Exit(
+ Thread_Control *the_thread,
+ void *value_ptr
+);
+
#endif
/* end of include file */
diff --git a/cpukit/posix/src/cancel.c b/cpukit/posix/src/cancel.c
index a10dd86735..9a3b18481a 100644
--- a/cpukit/posix/src/cancel.c
+++ b/cpukit/posix/src/cancel.c
@@ -1,5 +1,5 @@
/*
- * COPYRIGHT (c) 1989-2007.
+ * COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -34,9 +34,10 @@ int pthread_cancel(
pthread_t thread
)
{
- Thread_Control *the_thread;
- POSIX_API_Control *thread_support;
- Objects_Locations location;
+ Thread_Control *the_thread;
+ POSIX_API_Control *thread_support;
+ Objects_Locations location;
+ boolean cancel = FALSE;
/*
* Don't even think about deleting a resource from an ISR.
@@ -54,11 +55,12 @@ int pthread_cancel(
thread_support->cancelation_requested = 1;
if (thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
- thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS) {
- _POSIX_Threads_cancel_run( the_thread );
- }
+ thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS)
+ cancel = TRUE;
_Thread_Enable_dispatch();
+ if ( cancel )
+ _POSIX_Thread_Exit( the_thread, PTHREAD_CANCELED );
return 0;
#if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/posix/src/cancelrun.c b/cpukit/posix/src/cancelrun.c
index fff75ac1e4..8ac96a762d 100644
--- a/cpukit/posix/src/cancelrun.c
+++ b/cpukit/posix/src/cancelrun.c
@@ -25,12 +25,6 @@
#include <rtems/posix/pthread.h>
#include <rtems/posix/threadsup.h>
-/*PAGE
- *
- * _POSIX_Threads_cancel_run
- *
- */
-
void _POSIX_Threads_cancel_run(
Thread_Control *the_thread
)
@@ -57,14 +51,4 @@ void _POSIX_Threads_cancel_run(
_Workspace_Free( handler );
}
-
- /* Now we can delete the thread */
-
- the_thread->Wait.return_argument = PTHREAD_CANCELED;
- _Thread_Close(
- _Objects_Get_information_id( the_thread->Object.id ),
- the_thread
- );
- _POSIX_Threads_Free( the_thread );
-
}
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index 840aabc891..53126e2428 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -1,5 +1,5 @@
/*
- * COPYRIGHT (c) 1989-2007.
+ * COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -218,13 +218,16 @@ User_extensions_routine _POSIX_Threads_Delete_extension(
/*
* Run the POSIX cancellation handlers
*/
+ _POSIX_Threads_cancel_run( deleted );
+ /*
+ * Run all the key destructors
+ */
_POSIX_Keys_Run_destructors( deleted );
/*
* Wakeup all the tasks which joined with this one
*/
-
value_ptr = (void **) deleted->Wait.return_argument;
while ( (the_thread = _Thread_queue_Dequeue( &api->Join_List )) )
diff --git a/cpukit/posix/src/pthreadexit.c b/cpukit/posix/src/pthreadexit.c
index a8781f5c58..f85e736daa 100644
--- a/cpukit/posix/src/pthreadexit.c
+++ b/cpukit/posix/src/pthreadexit.c
@@ -22,29 +22,47 @@
#include <assert.h>
#include <rtems/system.h>
+#include <rtems/score/apimutex.h>
#include <rtems/score/thread.h>
#include <rtems/posix/pthread.h>
-void pthread_exit(
- void *value_ptr
+void _POSIX_Thread_Exit(
+ Thread_Control *the_thread,
+ void *value_ptr
)
{
Objects_Information *the_information;
- the_information = _Objects_Get_information_id( _Thread_Executing->Object.id );
+ the_information = _Objects_Get_information_id( the_thread->Object.id );
/*
- * the_information has to be non-NULL. Otherwise, we couldn't be
+ * The_information has to be non-NULL. Otherwise, we couldn't be
* running in a thread of this API and class.
+ *
+ * NOTE: Lock and unlock in different order so we do not throw a
+ * fatal error when locking the allocator mutex. And after
+ * we unlock, we want to defer the context switch until we
+ * are ready to be switched out. Otherwise, an ISR could
+ * occur and preempt us out while we still hold the
+ * allocator mutex.
*/
- _Thread_Disable_dispatch();
+ _RTEMS_Lock_allocator();
+ _Thread_Disable_dispatch();
- _Thread_Executing->Wait.return_argument = value_ptr;
+ the_thread->Wait.return_argument = value_ptr;
- _Thread_Close( the_information, _Thread_Executing );
+ _Thread_Close( the_information, the_thread );
- _POSIX_Threads_Free( _Thread_Executing );
+ _POSIX_Threads_Free( the_thread );
+ _RTEMS_Unlock_allocator();
_Thread_Enable_dispatch();
}
+
+void pthread_exit(
+ void *value_ptr
+)
+{
+ _POSIX_Thread_Exit( _Thread_Executing, value_ptr );
+}
diff --git a/cpukit/posix/src/setcancelstate.c b/cpukit/posix/src/setcancelstate.c
index 9bb75cb2e7..8df8f55d4b 100644
--- a/cpukit/posix/src/setcancelstate.c
+++ b/cpukit/posix/src/setcancelstate.c
@@ -1,5 +1,5 @@
/*
- * COPYRIGHT (c) 1989-2007.
+ * COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -35,7 +35,8 @@ int pthread_setcancelstate(
int *oldstate
)
{
- POSIX_API_Control *thread_support;
+ POSIX_API_Control *thread_support;
+ boolean cancel = FALSE;
/*
* Don't even think about deleting a resource from an ISR.
@@ -61,8 +62,10 @@ int pthread_setcancelstate(
if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS &&
thread_support->cancelation_requested )
- _POSIX_Threads_cancel_run( _Thread_Executing );
- _Thread_Enable_dispatch();
+ cancel = TRUE;
+ _Thread_Enable_dispatch();
+ if ( cancel )
+ _POSIX_Thread_Exit( _Thread_Executing, PTHREAD_CANCELED );
return 0;
}
diff --git a/cpukit/posix/src/setcanceltype.c b/cpukit/posix/src/setcanceltype.c
index 6a8a0c9860..fbd7beadf2 100644
--- a/cpukit/posix/src/setcanceltype.c
+++ b/cpukit/posix/src/setcanceltype.c
@@ -1,5 +1,5 @@
/*
- * COPYRIGHT (c) 1989-2007.
+ * COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -35,7 +35,8 @@ int pthread_setcanceltype(
int *oldtype
)
{
- POSIX_API_Control *thread_support;
+ POSIX_API_Control *thread_support;
+ boolean cancel = FALSE;
/*
* Don't even think about deleting a resource from an ISR.
@@ -61,8 +62,10 @@ int pthread_setcanceltype(
if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS &&
thread_support->cancelation_requested )
- _POSIX_Threads_cancel_run( _Thread_Executing );
+ cancel = TRUE;
_Thread_Enable_dispatch();
+ if ( cancel )
+ _POSIX_Thread_Exit( _Thread_Executing, PTHREAD_CANCELED );
return 0;
}
diff --git a/cpukit/posix/src/testcancel.c b/cpukit/posix/src/testcancel.c
index 2f60f6545f..2c60b0e72c 100644
--- a/cpukit/posix/src/testcancel.c
+++ b/cpukit/posix/src/testcancel.c
@@ -1,5 +1,5 @@
/*
- * COPYRIGHT (c) 1989-2007.
+ * COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -32,7 +32,8 @@
void pthread_testcancel( void )
{
- POSIX_API_Control *thread_support;
+ POSIX_API_Control *thread_support;
+ boolean cancel = FALSE;
/*
* Don't even think about deleting a resource from an ISR.
@@ -48,6 +49,9 @@ void pthread_testcancel( void )
_Thread_Disable_dispatch();
if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
thread_support->cancelation_requested )
- _POSIX_Threads_cancel_run( _Thread_Executing );
+ cancel = TRUE;
_Thread_Enable_dispatch();
+
+ if ( cancel )
+ _POSIX_Thread_Exit( _Thread_Executing, PTHREAD_CANCELED );
}
diff --git a/cpukit/rtems/src/taskdelete.c b/cpukit/rtems/src/taskdelete.c
index c7b1edb60c..be5b44ccea 100644
--- a/cpukit/rtems/src/taskdelete.c
+++ b/cpukit/rtems/src/taskdelete.c
@@ -67,31 +67,29 @@ rtems_status_code rtems_task_delete(
case OBJECTS_LOCAL:
the_information = _Objects_Get_information_id( the_thread->Object.id );
-#if defined(RTEMS_DEBUG)
- if ( !the_information ) {
- _Thread_Enable_dispatch();
- return RTEMS_INVALID_ID;
- /* This should never happen if _Thread_Get() works right */
- }
-#endif
+ #if defined(RTEMS_DEBUG)
+ if ( !the_information ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_INVALID_ID;
+ /* This should never happen if _Thread_Get() works right */
+ }
+ #endif
+
+ #if defined(RTEMS_MULTIPROCESSING)
+ if ( the_thread->is_global ) {
+ _Objects_MP_Close( &_RTEMS_tasks_Information, the_thread->Object.id );
+ _RTEMS_tasks_MP_Send_process_packet(
+ RTEMS_TASKS_MP_ANNOUNCE_DELETE,
+ the_thread->Object.id,
+ 0 /* Not used */
+ );
+ }
+ #endif
_Thread_Close( the_information, the_thread );
_RTEMS_tasks_Free( the_thread );
-#if defined(RTEMS_MULTIPROCESSING)
- if ( the_thread->is_global ) {
-
- _Objects_MP_Close( &_RTEMS_tasks_Information, the_thread->Object.id );
-
- _RTEMS_tasks_MP_Send_process_packet(
- RTEMS_TASKS_MP_ANNOUNCE_DELETE,
- the_thread->Object.id,
- 0 /* Not used */
- );
- }
-#endif
-
_RTEMS_Unlock_allocator();
_Thread_Enable_dispatch();
return RTEMS_SUCCESSFUL;
diff --git a/cpukit/score/inline/rtems/score/object.inl b/cpukit/score/inline/rtems/score/object.inl
index 730d8dc7f5..de18a7d680 100644
--- a/cpukit/score/inline/rtems/score/object.inl
+++ b/cpukit/score/inline/rtems/score/object.inl
@@ -228,6 +228,32 @@ RTEMS_INLINE_ROUTINE void _Objects_Set_local_object(
}
/**
+ * This function sets the pointer to the local_table object
+ * referenced by the index to a NULL so the object Id is invalid
+ * after this call.
+ *
+ * @param[in] information points to an Object Information Table
+ * @param[in] the_object is the local object pointer
+ *
+ * @note This routine is ONLY to be called in places where the
+ * index portion of the Id is known to be good. This is
+ * OK since it is normally called from object create/init
+ * or delete/destroy operations.
+ */
+
+RTEMS_INLINE_ROUTINE void _Objects_Invalidate_Id(
+ Objects_Information *information,
+ Objects_Control *the_object
+)
+{
+ _Objects_Set_local_object(
+ information,
+ _Objects_Get_index( the_object->id ),
+ NULL
+ );
+}
+
+/**
* This function places the_object control pointer and object name
* in the Local Pointer and Local Name Tables, respectively.
*
diff --git a/cpukit/score/src/objectclose.c b/cpukit/score/src/objectclose.c
index e28b8fdda6..1ed76b7fbe 100644
--- a/cpukit/score/src/objectclose.c
+++ b/cpukit/score/src/objectclose.c
@@ -22,11 +22,7 @@ void _Objects_Close(
Objects_Control *the_object
)
{
- _Objects_Set_local_object(
- information,
- _Objects_Get_index( the_object->id ),
- NULL
- );
+ _Objects_Invalidate_Id( information, the_object );
_Objects_Namespace_remove( information, the_object );
}
diff --git a/cpukit/score/src/threadclose.c b/cpukit/score/src/threadclose.c
index a29aebdca7..51db06f56c 100644
--- a/cpukit/score/src/threadclose.c
+++ b/cpukit/score/src/threadclose.c
@@ -45,6 +45,15 @@ void _Thread_Close(
Thread_Control *the_thread
)
{
+
+ /*
+ * Now we are in a dispatching critical section again and we
+ * can take the thread OUT of the published set. It is invalid
+ * to use this thread's Id after this call. This will prevent
+ * any other task from attempting to initiate a call on this task.
+ */
+ _Objects_Invalidate_Id( information, &the_thread->Object );
+
/*
* We assume the Allocator Mutex is locked when we get here.
* This provides sufficient protection to let the user extensions
@@ -61,7 +70,7 @@ void _Thread_Close(
/*
* Now we are in a dispatching critical section again and we
* can take the thread OUT of the published set. It is invalid
- * to use this thread's Id after this call.
+ * to use this thread's Id OR name after this call.
*/
_Objects_Close( information, &the_thread->Object );