diff options
author | Daniel Ramirez <javamonn@gmail.com> | 2013-11-30 20:27:44 -0600 |
---|---|---|
committer | Gedare Bloom <gedare@rtems.org> | 2013-11-30 21:31:30 -0500 |
commit | 72ff7569b096457332cd8de7fe0f00c16b87fb1b (patch) | |
tree | 19e10619f87748ee153e3b38e00ad1d7c253144c /testsuites/psxtmtests/psxtmcond03 | |
parent | psx07.doc: New file (diff) | |
download | rtems-72ff7569b096457332cd8de7fe0f00c16b87fb1b.tar.bz2 |
psxtmtests: added new psxtmcond04 test, fixed psxtmcond03
Diffstat (limited to 'testsuites/psxtmtests/psxtmcond03')
-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(); |