summaryrefslogtreecommitdiff
path: root/tests/inherit1.c
diff options
context:
space:
mode:
authorrpj <rpj>2003-09-18 02:31:39 +0000
committerrpj <rpj>2003-09-18 02:31:39 +0000
commitaf1871fba4fc253b5a31e4a0eed667fe79f534d7 (patch)
tree1242599d7334ae50c5c05f9b23b52876e4287924 /tests/inherit1.c
parentfac679912b15dd89cafdb09bf873d7eacc80a05e (diff)
Cleanup and fixes to thread priority management. Other minor changes.snap-2003-09-18
Diffstat (limited to 'tests/inherit1.c')
-rw-r--r--tests/inherit1.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/inherit1.c b/tests/inherit1.c
index 364aa74..288919c 100644
--- a/tests/inherit1.c
+++ b/tests/inherit1.c
@@ -97,21 +97,22 @@ void *
getValidPriorities(void * arg)
{
int prioSet;
- pthread_t threadID = pthread_self();
- HANDLE threadH = pthread_getw32threadhandle_np(threadID);
+ pthread_t thread = pthread_self();
+ HANDLE threadH = pthread_getw32threadhandle_np(thread);
+ struct sched_param param;
for (prioSet = minPrio;
prioSet <= maxPrio;
prioSet++)
{
- /*
+ /*
* If prioSet is invalid then the threads priority is unchanged
* from the previous value. Make the previous value a known
* one so that we can check later.
*/
- SetThreadPriority(threadH, PTW32TEST_THREAD_INIT_PRIO);
- SetThreadPriority(threadH, prioSet);
- validPriorities[prioSet+(PTW32TEST_MAXPRIORITIES/2)] = GetThreadPriority(threadH);
+ param.sched_priority = prioSet;
+ assert(pthread_setschedparam(thread, SCHED_OTHER, &param) == 0);
+ validPriorities[prioSet+(PTW32TEST_MAXPRIORITIES/2)] = GetThreadPriority(threadH);
}
return (void *) 0;
@@ -155,7 +156,9 @@ main()
assert(pthread_setschedparam(mainThread, SCHED_OTHER, &mainParam) == 0);
assert(pthread_getschedparam(mainThread, &policy, &mainParam) == 0);
assert(policy == SCHED_OTHER);
- assert(mainParam.sched_priority ==
+ /* Priority returned below should be the level set by pthread_setschedparam(). */
+ assert(mainParam.sched_priority == prio);
+ assert(GetThreadPriority(threadH) ==
validPriorities[prio+(PTW32TEST_MAXPRIORITIES/2)]);
for (param.sched_priority = prio;