diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-05-22 20:38:03 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-05-22 20:38:03 +0000 |
commit | 345fc11da9dcad5faa23f9888c8f3a0260e8ad45 (patch) | |
tree | 561c791f8d6342c00391dea6c1dd47f08ac82612 /cpukit/score | |
parent | 2008-05-22 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-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/score')
-rw-r--r-- | cpukit/score/inline/rtems/score/object.inl | 26 | ||||
-rw-r--r-- | cpukit/score/src/objectclose.c | 6 | ||||
-rw-r--r-- | cpukit/score/src/threadclose.c | 11 |
3 files changed, 37 insertions, 6 deletions
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 ); |