added test cases for ESRCH from pthread_join and pthread_detach

This commit is contained in:
Joel Sherrill
1996-08-07 22:00:57 +00:00
parent 84b03316d1
commit 42418a9d3c
2 changed files with 18 additions and 0 deletions

View File

@@ -32,6 +32,10 @@ void *POSIX_Init(
Init_id = pthread_self(); Init_id = pthread_self();
printf( "Init's ID is 0x%08x\n", Init_id ); printf( "Init's ID is 0x%08x\n", Init_id );
puts( "Init: pthread_detach - ESRCH (invalid id)" );
status = pthread_detach( -1 );
assert( status == ESRCH );
/* detach this thread */ /* detach this thread */
puts( "Init: pthread_detach self" ); puts( "Init: pthread_detach self" );
@@ -47,8 +51,13 @@ void *POSIX_Init(
status = pthread_create( &Task2_id, NULL, Task_2, NULL ); status = pthread_create( &Task2_id, NULL, Task_2, NULL );
assert( !status ); assert( !status );
puts( "Init: pthread_join - ESRCH (invalid id)" );
status = pthread_join( -1, &return_pointer );
assert( status == ESRCH );
puts( "Init: pthread_join - SUCCESSFUL" ); puts( "Init: pthread_join - SUCCESSFUL" );
status = pthread_join( Task_id, &return_pointer ); status = pthread_join( Task_id, &return_pointer );
/* assert is below comment */
/* switch to Task 1 */ /* switch to Task 1 */

View File

@@ -32,6 +32,10 @@ void *POSIX_Init(
Init_id = pthread_self(); Init_id = pthread_self();
printf( "Init's ID is 0x%08x\n", Init_id ); printf( "Init's ID is 0x%08x\n", Init_id );
puts( "Init: pthread_detach - ESRCH (invalid id)" );
status = pthread_detach( -1 );
assert( status == ESRCH );
/* detach this thread */ /* detach this thread */
puts( "Init: pthread_detach self" ); puts( "Init: pthread_detach self" );
@@ -47,8 +51,13 @@ void *POSIX_Init(
status = pthread_create( &Task2_id, NULL, Task_2, NULL ); status = pthread_create( &Task2_id, NULL, Task_2, NULL );
assert( !status ); assert( !status );
puts( "Init: pthread_join - ESRCH (invalid id)" );
status = pthread_join( -1, &return_pointer );
assert( status == ESRCH );
puts( "Init: pthread_join - SUCCESSFUL" ); puts( "Init: pthread_join - SUCCESSFUL" );
status = pthread_join( Task_id, &return_pointer ); status = pthread_join( Task_id, &return_pointer );
/* assert is below comment */
/* switch to Task 1 */ /* switch to Task 1 */