diff options
Diffstat (limited to 'c')
-rw-r--r-- | c/src/tests/psxtests/psx05/init.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/c/src/tests/psxtests/psx05/init.c b/c/src/tests/psxtests/psx05/init.c index a6f25fd42b..0171ed9f46 100644 --- a/c/src/tests/psxtests/psx05/init.c +++ b/c/src/tests/psxtests/psx05/init.c @@ -77,6 +77,7 @@ void *POSIX_Init( { int status; pthread_mutexattr_t attr; + pthread_mutexattr_t destroyed_attr; struct timespec times; struct sched_param param; int policy; @@ -94,7 +95,7 @@ void *POSIX_Init( Init_id = pthread_self(); printf( "Init's ID is 0x%08x\n", Init_id ); - /* basic checkout of mutex attributes */ + /* tes pthread_mutex_attr_init */ puts( "Init: pthread_mutexattr_init - EINVAL (NULL attr)" ); status = pthread_mutexattr_init( NULL ); @@ -106,6 +107,25 @@ void *POSIX_Init( Print_mutexattr( "Init: ", &attr ); + /* create an "uninitialized" attribute structure */ + + status = pthread_mutexattr_init( &destroyed_attr ); + assert( !status ); + + puts( "Init: pthread_mutexattr_destroy - SUCCESSFUL" ); + status = pthread_mutexattr_destroy( &destroyed_attr ); + assert( !status ); + + puts( "Init: pthread_mutexattr_destroy - EINVAL (NULL attr)" ); + status = pthread_mutexattr_destroy( NULL ); + assert( status == EINVAL ); + + puts( "Init: pthread_mutexattr_destroy - EINVAL (not initialized)" ); + status = pthread_mutexattr_destroy( &destroyed_attr ); + assert( status == EINVAL ); + + /* change the attributes structure */ + puts( "Init: Changing mutex attributes" ); status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_INHERIT ); assert( !status ); |