From aad3fe61d7d492bbb157c74d9f055f644b032d28 Mon Sep 17 00:00:00 2001 From: Mark Johannes Date: Mon, 12 Aug 1996 21:49:54 +0000 Subject: Init.c: added cases for signal, wait and broadcast --- c/src/tests/psxtests/psx10/init.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'c/src/tests') diff --git a/c/src/tests/psxtests/psx10/init.c b/c/src/tests/psxtests/psx10/init.c index de04bcdd82..0c679a2441 100644 --- a/c/src/tests/psxtests/psx10/init.c +++ b/c/src/tests/psxtests/psx10/init.c @@ -81,9 +81,6 @@ void *POSIX_Init( assert( status == EINVAL ); puts( "Init: pthread_condattr_getpshared - EINVAL" ); - Init_id = pthread_self(); - printf( "Init: ID is 0x%08x\n", Init_id ); - puts( "Init: pthread_cond_init - NULL attr" ); status = pthread_cond_init( &cond, NULL ); assert( !status ); @@ -93,15 +90,37 @@ void *POSIX_Init( assert( !status ); puts( "Init: pthread_cond_init - attr" ); - status = pthread_cond_init( &cond, &attr ); + status = pthread_cond_init( &Cond1_id, &attr ); assert( !status ); /* create a thread */ -/* - status = pthread_create( &thread_id, NULL, Task_1_through_3, NULL ); + empty_line(); + + status = pthread_create( &Task_id, NULL, Task_1, NULL ); + assert( !status ); + + puts( "Init: sleep to switch to Task_1" ); + sleep( 1 ); + + puts( "Init: pthread_cond_signal" ); + status = pthread_cond_signal( &Cond1_id ); + assert( !status ); + + empty_line(); + + status = pthread_create( &Task2_id, NULL, Task_2, NULL ); + assert( !status ); + + puts( "Init: sleep - switch to Task_1 and Task_2" ); + sleep( 1 ); + + puts( "Init: pthread_cond_broadcast" ); + status = pthread_cond_broadcast( &Cond1_id ); assert( !status ); -*/ + + puts( "Init: sleep - switch to Task_1" ); + sleep( 1 ); /* exit this thread */ -- cgit v1.2.3