diff options
Diffstat (limited to 'testsuites/psxtmtests/psxtmcond03/init.c')
-rw-r--r-- | testsuites/psxtmtests/psxtmcond03/init.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/testsuites/psxtmtests/psxtmcond03/init.c b/testsuites/psxtmtests/psxtmcond03/init.c index 4c1b9ad6d3..f2228b7378 100644 --- a/testsuites/psxtmtests/psxtmcond03/init.c +++ b/testsuites/psxtmtests/psxtmcond03/init.c @@ -30,8 +30,15 @@ void *Blocker( void *argument ) { + int status; + + status = pthread_mutex_lock(&MutexID); + rtems_test_assert( status == 0 ); + + /* Unlock mutex, block, wait for CondID to be signaled */ pthread_cond_wait(&CondID,&MutexID); - /* should never return */ + + /* should never return */ rtems_test_assert( FALSE ); return NULL; @@ -44,6 +51,8 @@ void *POSIX_Init( int status; pthread_t threadId; long end_time; + struct sched_param param; + int policy; puts( "\n\n*** POSIX TIME TEST PSXTMCOND03 ***" ); @@ -57,18 +66,19 @@ void *POSIX_Init( rtems_test_assert( status == 0 ); /* - * Ensure the mutex is unavailable so the other threads block. - */ - status = pthread_mutex_lock(&MutexID); - rtems_test_assert( status == 0 ); - - /* * Let the other thread start so the thread startup overhead, * is accounted for. When we return, we can start the benchmark. */ sched_yield(); /* let other thread run */ + /* To be extra sure we don't get preempted on the signal */ + status = pthread_getschedparam(pthread_self(), &policy, ¶m); + rtems_test_assert( status == 0); + param.sched_priority = sched_get_priority_max(policy) - 1; + status = pthread_setschedparam(pthread_self(), policy, ¶m); + rtems_test_assert( status == 0); + benchmark_timer_initialize(); status = pthread_cond_signal(&CondID); end_time = benchmark_timer_read(); |