diff options
author | Daniel Ramirez <javamonn@gmail.com> | 2013-11-30 15:42:38 -0600 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@oarcorp.com> | 2013-11-30 15:50:25 -0600 |
commit | 115e0591317481cb622913d46f4164d7db34fa1b (patch) | |
tree | 95fa331add37a01d187a80b57bdddba9844b0aea /testsuites/psxtmtests/psxtmthread02/init.c | |
parent | psxtmtests_plan.csv: Replace comma with colon (diff) | |
download | rtems-115e0591317481cb622913d46f4164d7db34fa1b.tar.bz2 |
fixed psxtmthread02 test, updated .csv to be in sync and added test .docs
Diffstat (limited to 'testsuites/psxtmtests/psxtmthread02/init.c')
-rw-r--r-- | testsuites/psxtmtests/psxtmthread02/init.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/testsuites/psxtmtests/psxtmthread02/init.c b/testsuites/psxtmtests/psxtmthread02/init.c index 9e44873937..bfa3ab8c9a 100644 --- a/testsuites/psxtmtests/psxtmthread02/init.c +++ b/testsuites/psxtmtests/psxtmthread02/init.c @@ -1,5 +1,5 @@ /* - * COPYRIGHT (c) 1989-2012. + * COPYRIGHT (c) 1989-2013. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -23,19 +23,29 @@ void *thread(void *argument); void benchmark_pthread_create(void) { - long end_time; int status; pthread_t thread_ID; + pthread_attr_t attr; + struct sched_param param; + + pthread_attr_init(&attr); + pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + pthread_attr_setschedpolicy(&attr, SCHED_FIFO); + param.sched_priority = sched_get_priority_max(SCHED_FIFO) - 1; + pthread_attr_setschedparam(&attr, ¶m); + /* create second thread with max priority and get preempted on creation */ benchmark_timer_initialize(); - - status = pthread_create(&thread_ID, NULL, thread, NULL); - rtems_test_assert( status == 0 ); - - end_time = benchmark_timer_read(); + status = pthread_create(&thread_ID, &attr, thread, NULL); +} - rtems_test_assert( status == 0 ); +void *thread( + void *argument +) +{ + long end_time; + end_time = benchmark_timer_read(); put_time( "pthread_create - preempt", end_time, @@ -43,14 +53,6 @@ void benchmark_pthread_create(void) 0, 0 ); - -} - -void *thread( - void *argument -) -{ - //Empty thread used in pthread_create(). return NULL; } |