diff options
Diffstat (limited to '')
-rw-r--r-- | c/src/tests/psxtests/psx05/init.c | 13 | ||||
-rw-r--r-- | c/src/tests/psxtests/psx05/task.c | 6 | ||||
-rw-r--r-- | testsuites/psxtests/psx05/init.c | 13 | ||||
-rw-r--r-- | testsuites/psxtests/psx05/task.c | 6 |
4 files changed, 38 insertions, 0 deletions
diff --git a/c/src/tests/psxtests/psx05/init.c b/c/src/tests/psxtests/psx05/init.c index f2b09cefd7..dea46f8714 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; + struct timespec times; puts( "\n\n*** POSIX TEST 5 ***" ); @@ -164,6 +165,18 @@ void *POSIX_Init( printf( "status = %d\n", status ); assert( status == EPERM ); + times.tv_sec = 0; + times.tv_nsec = 500000000; + printf( "Init: pthread_mutex_timedlock time out in 1/2 second\n" ); + status = pthread_mutex_timedlock( &Mutex_id, × ); + if ( status != EAGAIN ) + printf( "status = %d\n", status ); + assert( status == EAGAIN ); + + /* switch to idle */ + + printf( "Init: correctly timed out waiting for mutex\n" ); + puts( "*** END OF POSIX TEST 5 ***" ); exit( 0 ); diff --git a/c/src/tests/psxtests/psx05/task.c b/c/src/tests/psxtests/psx05/task.c index 9e0fa7d333..2c687744ea 100644 --- a/c/src/tests/psxtests/psx05/task.c +++ b/c/src/tests/psxtests/psx05/task.c @@ -40,8 +40,14 @@ void *Task_1_through_3( printf( "status = %d\n", status ); assert( !status ); + /* switch to init */ + printf( "Task: mutex acquired\n" ); + printf( "Task: sleep for 2 seconds\n" ); + sleep( 2 ); + + /* switch to init */ printf( "Task: exit\n" ); pthread_exit( NULL ); diff --git a/testsuites/psxtests/psx05/init.c b/testsuites/psxtests/psx05/init.c index f2b09cefd7..dea46f8714 100644 --- a/testsuites/psxtests/psx05/init.c +++ b/testsuites/psxtests/psx05/init.c @@ -77,6 +77,7 @@ void *POSIX_Init( { int status; pthread_mutexattr_t attr; + struct timespec times; puts( "\n\n*** POSIX TEST 5 ***" ); @@ -164,6 +165,18 @@ void *POSIX_Init( printf( "status = %d\n", status ); assert( status == EPERM ); + times.tv_sec = 0; + times.tv_nsec = 500000000; + printf( "Init: pthread_mutex_timedlock time out in 1/2 second\n" ); + status = pthread_mutex_timedlock( &Mutex_id, × ); + if ( status != EAGAIN ) + printf( "status = %d\n", status ); + assert( status == EAGAIN ); + + /* switch to idle */ + + printf( "Init: correctly timed out waiting for mutex\n" ); + puts( "*** END OF POSIX TEST 5 ***" ); exit( 0 ); diff --git a/testsuites/psxtests/psx05/task.c b/testsuites/psxtests/psx05/task.c index 9e0fa7d333..2c687744ea 100644 --- a/testsuites/psxtests/psx05/task.c +++ b/testsuites/psxtests/psx05/task.c @@ -40,8 +40,14 @@ void *Task_1_through_3( printf( "status = %d\n", status ); assert( !status ); + /* switch to init */ + printf( "Task: mutex acquired\n" ); + printf( "Task: sleep for 2 seconds\n" ); + sleep( 2 ); + + /* switch to init */ printf( "Task: exit\n" ); pthread_exit( NULL ); |