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/task2.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/task2.c')
-rw-r--r-- | c/src/tests/psxtests/psx08/task2.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/c/src/tests/psxtests/psx08/task2.c b/c/src/tests/psxtests/psx08/task2.c index 028df4cb91..e890535a65 100644 --- a/c/src/tests/psxtests/psx08/task2.c +++ b/c/src/tests/psxtests/psx08/task2.c @@ -27,26 +27,30 @@ void *Task_2( ) { int status; - void *return_pointer; - puts( "Task_2: join to Task_1" ); - status = pthread_join( Task_id, &return_pointer ); - puts( "Task_2: returned from pthread_join" ); - if ( status ) + puts( "Task_2: sleep 1 second" ); + + sleep( 1 ); + + /* switch to task 3 */ + + puts( "Task_2: join to detached task (Init) -- EINVAL" ); + status = pthread_join( Init_id, NULL ); + if ( status != EINVAL ) + printf( "status = %d\n", status ); + assert( status == EINVAL ); + + puts( "Task_2: join to self task (Init) -- EDEADLK" ); + status = pthread_join( pthread_self(), NULL ); + if ( status != EDEADLK ) printf( "status = %d\n", status ); - assert( !status ); - - if ( return_pointer == &Task_id ) - puts( "Task_2: pthread_join returned correct pointer" ); - else - printf( - "Task_2: pthread_join returned incorrect pointer (%p != %p)\n", - return_pointer, - &Task_id - ); - - puts( "*** END OF POSIX TEST 8 ***" ); - exit( 0 ); + assert( status == EDEADLK ); + + puts( "Task_2: exitting" ); + + pthread_exit( &Task2_id ); + + /* switch to init task */ return NULL; /* just so the compiler thinks we returned something */ } |