diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1996-08-09 19:55:04 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1996-08-09 19:55:04 +0000 |
commit | 13adea03e0766f2c659ecf2cb3a6eb252ad551d6 (patch) | |
tree | cee6fffe5f7485955f03cac5828fe28705fcd640 /c/src/tests/psxtests/psx05/init.c | |
parent | added test case for pthread_mutexattr_init being passed a null pointer. (diff) | |
download | rtems-13adea03e0766f2c659ecf2cb3a6eb252ad551d6.tar.bz2 |
added test cases for EINVAL cases in pthread_mutexattr_destroy
Diffstat (limited to 'c/src/tests/psxtests/psx05/init.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 ); |