diff --git a/testing/getprime/Kconfig b/testing/getprime/Kconfig index 5085ac783..239492126 100644 --- a/testing/getprime/Kconfig +++ b/testing/getprime/Kconfig @@ -27,4 +27,8 @@ config TESTING_GETPRIME_STACKSIZE int "getprime stack size" default DEFAULT_TASK_STACKSIZE +config TESTING_GETPRIME_THREAD_PRIORITY + int "getprime thread priority" + default 10 + endif diff --git a/testing/getprime/getprime_main.c b/testing/getprime/getprime_main.c index bace6106c..b72b50e2e 100644 --- a/testing/getprime/getprime_main.c +++ b/testing/getprime/getprime_main.c @@ -111,7 +111,6 @@ static FAR void *thread_func(FAR void *param) static void get_prime_in_parallel(int n) { pthread_t thread[MAX_THREADS]; - struct sched_param sparam; pthread_attr_t attr; pthread_addr_t result; int status; @@ -120,16 +119,24 @@ static void get_prime_in_parallel(int n) status = pthread_attr_init(&attr); ASSERT(status == OK); - sparam.sched_priority = sched_get_priority_min(SCHED_FIFO); + struct sched_param sparam; + sparam.sched_priority = CONFIG_TESTING_GETPRIME_THREAD_PRIORITY; status = pthread_attr_setschedparam(&attr, &sparam); ASSERT(status == OK); printf("Set thread priority to %d\n", sparam.sched_priority); +#if CONFIG_RR_INTERVAL > 0 + status = pthread_attr_setschedpolicy(&attr, SCHED_RR); + ASSERT(status == OK); + + printf("Set thread policy to SCHED_RR \n"); +#else status = pthread_attr_setschedpolicy(&attr, SCHED_FIFO); ASSERT(status == OK); printf("Set thread policy to SCHED_FIFO \n"); +#endif for (i = 0; i < n; i++) {