posix: Delete key/value if value is set to NULL

This commit is contained in:
Sebastian Huber
2014-12-12 13:16:11 +01:00
parent dac340dd66
commit 172e953147
4 changed files with 106 additions and 38 deletions

View File

@@ -30,6 +30,7 @@ rtems_task Init(rtems_task_argument ignored)
bool ok;
rtems_resource_snapshot snapshot;
void *greedy;
void *value;
TEST_BEGIN();
@@ -40,6 +41,24 @@ rtems_task Init(rtems_task_argument ignored)
eno = pthread_key_create( &key1, NULL );
rtems_test_assert( eno == 0 );
eno = pthread_setspecific( key1, (void *) 1 );
rtems_test_assert( eno == 0 );
value = pthread_getspecific( key1 );
rtems_test_assert( value == (void *) 1 );
eno = pthread_setspecific( key1, NULL );
rtems_test_assert( eno == 0 );
value = pthread_getspecific( key1 );
rtems_test_assert( value == NULL );
eno = pthread_setspecific( key1, NULL );
rtems_test_assert( eno == 0 );
value = pthread_getspecific( key1 );
rtems_test_assert( value == NULL );
puts( "Init - pthread_key_create - EAGAIN" );
eno = pthread_key_create( &key2, NULL );
rtems_test_assert( eno == EAGAIN );