mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-20 20:54:18 +08:00
posix: Use _Objects_Put() for POSIX keys
This commit is contained in:
@@ -38,13 +38,14 @@ void *pthread_getspecific(
|
||||
pthread_key_t key
|
||||
)
|
||||
{
|
||||
POSIX_Keys_Control *the_key;
|
||||
Objects_Locations location;
|
||||
POSIX_Keys_Key_value_pair search_node;
|
||||
RBTree_Node *p;
|
||||
void *key_data;
|
||||
POSIX_Keys_Key_value_pair *value_pair_p;
|
||||
|
||||
_POSIX_Keys_Get( key, &location );
|
||||
the_key = _POSIX_Keys_Get( key, &location );
|
||||
switch ( location ) {
|
||||
|
||||
case OBJECTS_LOCAL:
|
||||
@@ -62,7 +63,9 @@ void *pthread_getspecific(
|
||||
/* Key_value_lookup_node )->value; */
|
||||
key_data = value_pair_p->value;
|
||||
}
|
||||
_Thread_Enable_dispatch();
|
||||
|
||||
_Objects_Put( &the_key->Object );
|
||||
|
||||
return key_data;
|
||||
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
|
||||
@@ -75,10 +75,8 @@ void _POSIX_Keys_Run_destructors(
|
||||
value = ((POSIX_Keys_Key_value_pair *)iter)->value;
|
||||
if ( destructor != NULL && value != NULL )
|
||||
(*destructor)( value );
|
||||
/**
|
||||
* disable dispatch is nested here
|
||||
*/
|
||||
_Thread_Enable_dispatch();
|
||||
|
||||
_Objects_Put( &the_key->Object );
|
||||
|
||||
/**
|
||||
* put back this node to keypool
|
||||
|
||||
@@ -34,18 +34,20 @@ int pthread_setspecific(
|
||||
const void *value
|
||||
)
|
||||
{
|
||||
POSIX_Keys_Control *the_key;
|
||||
Objects_Locations location;
|
||||
POSIX_Keys_Key_value_pair *value_pair_ptr;
|
||||
POSIX_API_Control *api;
|
||||
|
||||
_POSIX_Keys_Get( key, &location );
|
||||
the_key = _POSIX_Keys_Get( key, &location );
|
||||
switch ( location ) {
|
||||
|
||||
case OBJECTS_LOCAL:
|
||||
value_pair_ptr = ( POSIX_Keys_Key_value_pair * )
|
||||
_Freechain_Get( &_POSIX_Keys_Keypool.super_fc );
|
||||
if ( !value_pair_ptr ) {
|
||||
_Thread_Enable_dispatch();
|
||||
_Objects_Put( &the_key->Object );
|
||||
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
@@ -56,7 +58,8 @@ int pthread_setspecific(
|
||||
&(value_pair_ptr->Key_value_lookup_node) ) ) {
|
||||
_Freechain_Put( (Freechain_Control *)&_POSIX_Keys_Keypool,
|
||||
(void *) value_pair_ptr );
|
||||
_Thread_Enable_dispatch();
|
||||
_Objects_Put( &the_key->Object );
|
||||
|
||||
return EAGAIN;
|
||||
}
|
||||
|
||||
@@ -65,7 +68,8 @@ int pthread_setspecific(
|
||||
(_Thread_Executing->API_Extensions[THREAD_API_POSIX]);
|
||||
_Chain_Append_unprotected( &api->Key_Chain, &value_pair_ptr->Key_values_per_thread_node );
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
_Objects_Put( &the_key->Object );
|
||||
|
||||
return 0;
|
||||
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
|
||||
Reference in New Issue
Block a user