diff options
Diffstat (limited to 'testsuites/psxtmtests/psxtmthread05/init.c')
-rw-r--r-- | testsuites/psxtmtests/psxtmthread05/init.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/testsuites/psxtmtests/psxtmthread05/init.c b/testsuites/psxtmtests/psxtmthread05/init.c index 78f0465c70..11c84c526c 100644 --- a/testsuites/psxtmtests/psxtmthread05/init.c +++ b/testsuites/psxtmtests/psxtmthread05/init.c @@ -2,7 +2,6 @@ * COPYRIGHT (c) 1989-2012. * On-Line Applications Research Corporation (OAR). * COPYRIGHT (c) 2013. - * Chirayu Desai (chirayudesai1@gmail.com). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -37,14 +36,16 @@ void benchmark_pthread_setschedparam(void) /* make test_thread equal to POSIX_Init() */ pthread_getschedparam(pthread_self(), &policy, ¶m); + pthread_setschedparam(thread_ID, policy, ¶m); /* At this point, we've switched to test_thread */ /* Back from test_thread, switch to test_thread again */ - param.sched_priority = sched_get_priority_max(policy) - 1; + param.sched_priority = sched_get_priority_min(policy); benchmark_timer_initialize(); - pthread_setschedparam(thread_ID, policy, ¶m); + //lower own priority to minimun, scheduler forces an involuntary context switch + pthread_setschedparam(pthread_self(), policy, ¶m); } void *test_thread( @@ -52,12 +53,9 @@ void *test_thread( ) { long end_time; - - /* switch to POSIX_Init */ sched_yield(); end_time = benchmark_timer_read(); - put_time( "pthread_setschedparam - lower own priority, preempt", end_time, |