diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-10-04 19:41:34 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-10-04 19:41:34 +0000 |
commit | 7d9632183419c75b6606cf5d7da429a1279c6493 (patch) | |
tree | 4b2a053915155d5deb85662bdba6ea4ed970f253 /c/src/tests/psxtests/psx08/init.c | |
parent | Patch from Ralf Corsepius <corsepiu@faw.uni-ulm.de> to make fix bug (diff) | |
download | rtems-7d9632183419c75b6606cf5d7da429a1279c6493.tar.bz2 |
Modifications necessary to support testing of exitting a pthread from
Charles-Antione Gauthier <charles.gauthier@iit.nrc.ca>.
Diffstat (limited to 'c/src/tests/psxtests/psx08/init.c')
-rw-r--r-- | c/src/tests/psxtests/psx08/init.c | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/c/src/tests/psxtests/psx08/init.c b/c/src/tests/psxtests/psx08/init.c index f1ec5a6b09..638a595bcb 100644 --- a/c/src/tests/psxtests/psx08/init.c +++ b/c/src/tests/psxtests/psx08/init.c @@ -44,11 +44,7 @@ void *POSIX_Init( /* create thread */ - puts( "Init: creating two tasks" ); - status = pthread_create( &Task_id, NULL, Task_1, NULL ); - assert( !status ); - - status = pthread_create( &Task2_id, NULL, Task_2, NULL ); + status = pthread_create( &Task1_id, NULL, Task_1, NULL ); assert( !status ); puts( "Init: pthread_join - ESRCH (invalid id)" ); @@ -56,27 +52,47 @@ void *POSIX_Init( assert( status == ESRCH ); puts( "Init: pthread_join - SUCCESSFUL" ); - status = pthread_join( Task_id, &return_pointer ); - /* assert is below comment */ + status = pthread_join( Task1_id, &return_pointer ); - /* switch to Task 1 */ + puts( "Init: returned from pthread_join through return" ); + if ( status ) + printf( "status = %d\n", status ); + assert( !status ); - puts( "Init: returned from pthread_join" ); + if ( return_pointer == &Task1_id ) + puts( "Init: pthread_join returned correct pointer" ); + else + printf( + "Init: pthread_join returned incorrect pointer (%p != %p)\n", + return_pointer, + &Task1_id + ); + + puts( "Init: creating two pthreads" ); + status = pthread_create( &Task2_id, NULL, Task_2, NULL ); + assert( !status ); + + status = pthread_create( &Task3_id, NULL, Task_3, NULL ); + assert( !status ); + + puts( "Init: pthread_join - SUCCESSFUL" ); + status = pthread_join( Task2_id, &return_pointer ); + /* assert is below comment */ + + puts( "Init: returned from pthread_join through pthread_exit" ); if ( status ) printf( "status = %d\n", status ); assert( !status ); - if ( return_pointer == &Task_id ) + if ( return_pointer == &Task2_id ) puts( "Init: pthread_join returned correct pointer" ); else printf( "Init: pthread_join returned incorrect pointer (%p != %p)\n", return_pointer, - &Task_id + &Task2_id ); puts( "Init: exitting" ); - pthread_exit( NULL ); - - return NULL; /* just so the compiler thinks we returned something */ + return NULL; } |