123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- #include "test.h"
- enum
- {
- PTW32TEST_THREAD_INIT_PRIO = 0,
- PTW32TEST_MAXPRIORITIES = 512
- };
- static int pthreadPrio;
- static void *
- func(void * arg)
- {
- int policy;
- struct sched_param param;
- pthread_t threadID = pthread_self();
- assert(pthread_getschedparam(threadID, &policy, ¶m) == 0);
- assert(policy == SCHED_OTHER);
- assert(param.sched_priority == (int) pthreadPrio);
- assert(pte_osThreadGetPriority(pte_osThreadGetHandle()) == param.sched_priority);
- return (void *) 0;
- }
- int pthread_test_priority1()
- {
- pthread_t t;
- pthread_attr_t attr;
- void * result = NULL;
- struct sched_param param;
- assert(pthread_attr_init(&attr) == 0);
- assert(pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED) == 0);
- param.sched_priority = sched_get_priority_min(SCHED_OTHER) + 1;
- pthreadPrio = sched_get_priority_min(SCHED_OTHER) + 1;
- assert(pthread_attr_setschedparam(&attr, ¶m) == 0);
- assert(pthread_create(&t, &attr, func, (void *) &attr) == 0);
- assert(pthread_join(t, &result) == 0);
- return 0;
- }
|