forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2009-07-21 Joel Sherrill <joel.sherrill@OARcorp.com>
|
2009-07-21 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||||
|
|
||||||
* rtems/src/eventseize.c, rtems/src/eventsurrender.c,
|
* rtems/src/eventseize.c, rtems/src/eventsurrender.c,
|
||||||
|
|||||||
@@ -24,62 +24,58 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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
|
* @note The Values is a table indexed by the index portion of the
|
||||||
* ID of the currently executing thread.
|
* ID of the currently executing thread.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
/** This field is the Object control structure. */
|
||||||
Objects_Control Object;
|
Objects_Control Object;
|
||||||
bool is_active;
|
/** This field points to the optional destructor method. */
|
||||||
void (*destructor)( void * );
|
void (*destructor)( void * );
|
||||||
|
/** This field points to the values per thread. */
|
||||||
void **Values[ OBJECTS_APIS_LAST + 1 ];
|
void **Values[ OBJECTS_APIS_LAST + 1 ];
|
||||||
} POSIX_Keys_Control;
|
} POSIX_Keys_Control;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* The following defines the information control block used to manage
|
* The following defines the information control block used to manage
|
||||||
* this class of objects.
|
* this class of objects.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
POSIX_EXTERN Objects_Information _POSIX_Keys_Information;
|
POSIX_EXTERN Objects_Information _POSIX_Keys_Information;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* _POSIX_Keys_Manager_initialization
|
* @brief _POSIX_Keys_Manager_initialization
|
||||||
*
|
|
||||||
* DESCRIPTION:
|
|
||||||
*
|
*
|
||||||
* This routine performs the initialization necessary for this manager.
|
* This routine performs the initialization necessary for this manager.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void _POSIX_Key_Manager_initialization(void);
|
void _POSIX_Key_Manager_initialization(void);
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* _POSIX_Keys_Run_destructors
|
* @brief _POSIX_Keys_Run_destructors
|
||||||
*
|
|
||||||
* DESCRIPTION:
|
|
||||||
*
|
*
|
||||||
* This function executes all the destructors associated with the thread's
|
* This function executes all the destructors associated with the thread's
|
||||||
* keys. This function will execute until all values have been set to NULL.
|
* keys. This function will execute until all values have been set to NULL.
|
||||||
*
|
*
|
||||||
* NOTE: This is the routine executed when a thread exits to
|
* @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.
|
* run through all the keys and do the destructor action.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void _POSIX_Keys_Run_destructors(
|
void _POSIX_Keys_Run_destructors(
|
||||||
Thread_Control *thread
|
Thread_Control *thread
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* _POSIX_Keys_Free
|
* @brief _POSIX_Keys_Free
|
||||||
*
|
|
||||||
* DESCRIPTION:
|
|
||||||
*
|
*
|
||||||
* This routine frees a keys control block to the
|
* This routine frees a keys control block to the
|
||||||
* inactive chain of free keys control blocks.
|
* inactive chain of free keys control blocks.
|
||||||
|
*
|
||||||
|
* @param[in] the_key is the POSIX key to free.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
RTEMS_INLINE_ROUTINE void _POSIX_Keys_Free (
|
RTEMS_INLINE_ROUTINE void _POSIX_Keys_Free (
|
||||||
POSIX_Keys_Control *the_key
|
POSIX_Keys_Control *the_key
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -96,8 +96,6 @@ int pthread_key_create(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
the_key->is_active = true;
|
|
||||||
|
|
||||||
_Objects_Open_u32( &_POSIX_Keys_Information, &the_key->Object, 0 );
|
_Objects_Open_u32( &_POSIX_Keys_Information, &the_key->Object, 0 );
|
||||||
|
|
||||||
*key = the_key->Object.id;
|
*key = the_key->Object.id;
|
||||||
|
|||||||
@@ -42,11 +42,7 @@ int pthread_key_delete(
|
|||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
_Objects_Close( &_POSIX_Keys_Information, &the_key->Object );
|
_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 ] )
|
if ( the_key->Values[ the_api ] )
|
||||||
_Workspace_Free( the_key->Values[ the_api ] );
|
_Workspace_Free( the_key->Values[ the_api ] );
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,11 @@ void _POSIX_Keys_Run_destructors(
|
|||||||
the_key = (POSIX_Keys_Control *)
|
the_key = (POSIX_Keys_Control *)
|
||||||
_POSIX_Keys_Information.local_table[ index ];
|
_POSIX_Keys_Information.local_table[ index ];
|
||||||
|
|
||||||
if ( the_key && the_key->is_active && the_key->destructor ) {
|
if ( !the_key )
|
||||||
|
continue;
|
||||||
|
if ( !the_key->destructor )
|
||||||
|
continue;
|
||||||
|
|
||||||
value = the_key->Values[ thread_api ][ thread_index ];
|
value = the_key->Values[ thread_api ][ thread_index ];
|
||||||
if ( value ) {
|
if ( value ) {
|
||||||
(*the_key->destructor)( value );
|
(*the_key->destructor)( value );
|
||||||
@@ -67,7 +71,6 @@ void _POSIX_Keys_Run_destructors(
|
|||||||
are_all_null = false;
|
are_all_null = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ( are_all_null == true )
|
if ( are_all_null == true )
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user