diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-07-22 00:09:31 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-07-22 00:09:31 +0000 |
commit | 12a191ae15f78ba4a7df15b2bea6d74aa8aff707 (patch) | |
tree | 91f07e9c2b9c0d3a760edfd3593799c028543646 /cpukit/posix | |
parent | 2009-07-21 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-12a191ae15f78ba4a7df15b2bea6d74aa8aff707.tar.bz2 |
2009-07-21 Joel Sherrill <joel.sherrill@OARcorp.com>
* posix/include/rtems/posix/key.h, posix/src/keycreate.c,
posix/src/keydelete.c, posix/src/keyrundestructors.c: Restructure a
bit to make it easier to do coverage analysis. Eliminate is_active
member of control structure because it was redundant with very the
key object was open or closed.
Diffstat (limited to 'cpukit/posix')
-rw-r--r-- | cpukit/posix/include/rtems/posix/key.h | 46 | ||||
-rw-r--r-- | cpukit/posix/src/keycreate.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/keydelete.c | 6 | ||||
-rw-r--r-- | cpukit/posix/src/keyrundestructors.c | 17 |
4 files changed, 32 insertions, 39 deletions
diff --git a/cpukit/posix/include/rtems/posix/key.h b/cpukit/posix/include/rtems/posix/key.h index b8a8881137..1529076ce7 100644 --- a/cpukit/posix/include/rtems/posix/key.h +++ b/cpukit/posix/include/rtems/posix/key.h @@ -24,62 +24,58 @@ extern "C" { #endif -/* - * Data Structure used to manage a POSIX key +/** + * This is the data Structure used to manage a POSIX key. * - * NOTE: The Values is a table indexed by the index portion of the - * ID of the currently executing thread. + * @note The Values is a table indexed by the index portion of the + * ID of the currently executing thread. */ - typedef struct { + /** This field is the Object control structure. */ Objects_Control Object; - bool is_active; + /** This field points to the optional destructor method. */ void (*destructor)( void * ); + /** This field points to the values per thread. */ void **Values[ OBJECTS_APIS_LAST + 1 ]; } POSIX_Keys_Control; -/* +/** * The following defines the information control block used to manage * this class of objects. */ - POSIX_EXTERN Objects_Information _POSIX_Keys_Information; -/* - * _POSIX_Keys_Manager_initialization - * - * DESCRIPTION: +/** + * @brief _POSIX_Keys_Manager_initialization * * This routine performs the initialization necessary for this manager. */ - void _POSIX_Key_Manager_initialization(void); -/* - * _POSIX_Keys_Run_destructors - * - * DESCRIPTION: +/** + * @brief _POSIX_Keys_Run_destructors * * This function executes all the destructors associated with the thread's * keys. This function will execute until all values have been set to NULL. * - * NOTE: This is the routine executed when a thread exits to - * run through all the keys and do the destructor action. + * @param[in] thread is the thread whose keys should have all their + * destructors run. + * + * @note This is the routine executed when a thread exits to + * run through all the keys and do the destructor action. */ - void _POSIX_Keys_Run_destructors( Thread_Control *thread ); -/* - * _POSIX_Keys_Free - * - * DESCRIPTION: +/** + * @brief _POSIX_Keys_Free * * This routine frees a keys control block to the * inactive chain of free keys control blocks. + * + * @param[in] the_key is the POSIX key to free. */ - RTEMS_INLINE_ROUTINE void _POSIX_Keys_Free ( POSIX_Keys_Control *the_key ); diff --git a/cpukit/posix/src/keycreate.c b/cpukit/posix/src/keycreate.c index 4e26e7d6eb..fdaa5f096d 100644 --- a/cpukit/posix/src/keycreate.c +++ b/cpukit/posix/src/keycreate.c @@ -96,8 +96,6 @@ int pthread_key_create( } - the_key->is_active = true; - _Objects_Open_u32( &_POSIX_Keys_Information, &the_key->Object, 0 ); *key = the_key->Object.id; diff --git a/cpukit/posix/src/keydelete.c b/cpukit/posix/src/keydelete.c index 0abfee14c7..d4c58dd4cc 100644 --- a/cpukit/posix/src/keydelete.c +++ b/cpukit/posix/src/keydelete.c @@ -42,11 +42,7 @@ int pthread_key_delete( case OBJECTS_LOCAL: _Objects_Close( &_POSIX_Keys_Information, &the_key->Object ); - the_key->is_active = false; - - for ( the_api = 1; - the_api <= OBJECTS_APIS_LAST; - the_api++ ) + for ( the_api = 1; the_api <= OBJECTS_APIS_LAST; the_api++ ) if ( the_key->Values[ the_api ] ) _Workspace_Free( the_key->Values[ the_api ] ); diff --git a/cpukit/posix/src/keyrundestructors.c b/cpukit/posix/src/keyrundestructors.c index 79f671e036..3d5c0dae68 100644 --- a/cpukit/posix/src/keyrundestructors.c +++ b/cpukit/posix/src/keyrundestructors.c @@ -59,13 +59,16 @@ void _POSIX_Keys_Run_destructors( the_key = (POSIX_Keys_Control *) _POSIX_Keys_Information.local_table[ index ]; - if ( the_key && the_key->is_active && the_key->destructor ) { - value = the_key->Values[ thread_api ][ thread_index ]; - if ( value ) { - (*the_key->destructor)( value ); - if ( the_key->Values[ thread_api ][ thread_index ] ) - are_all_null = false; - } + if ( !the_key ) + continue; + if ( !the_key->destructor ) + continue; + + value = the_key->Values[ thread_api ][ thread_index ]; + if ( value ) { + (*the_key->destructor)( value ); + if ( the_key->Values[ thread_api ][ thread_index ] ) + are_all_null = false; } } |