summaryrefslogtreecommitdiff
path: root/sched.c
diff options
context:
space:
mode:
authorrpj <rpj>2001-10-25 13:24:58 +0000
committerrpj <rpj>2001-10-25 13:24:58 +0000
commit222a76c37c89ee37eebecd53dd32fd481245e6fa (patch)
tree160ed8d069da4d9e94b16c436943def676e355c5 /sched.c
parent7b714286cfd65e797364fbdc583e13adba71a2ee (diff)
* barrier.c: Move _LONG and _LPLONG defines into
implement.h; rename to PTW32_INTERLOCKED_LONG and PTW32_INTERLOCKED_LPLONG respectively. * spin.c: Likewise; ptw32_interlocked_compare_exchange used in place of InterlockedCompareExchange directly. * global.c (ptw32_interlocked_compare_exchange): Add prototype for this new routine pointer to be used when InterlockedCompareExchange isn't supported by Windows. * nonportable.c (pthread_win32_process_attach_np): Check for support of InterlockedCompareExchange in kernel32 and assign its address to ptw32_interlocked_compare_exchange if it exists, or our own ix86 specific implementation ptw32_InterlockedCompareExchange. *private.c (ptw32_InterlockedCompareExchange): An implementation of InterlockedCompareExchange() which is specific to ix86; written directly in assembler for either MSVC or GNU C; needed because Windows 95 doesn't support InterlockedCompareExchange(). * sched.c (sched_get_priority_min): Extend to return THREAD_PRIORITY_IDLE. (sched_get_priority_max): Extend to return THREAD_PRIORITY_CRITICAL.
Diffstat (limited to 'sched.c')
-rw-r--r--sched.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sched.c b/sched.c
index bc8aca0..8ef502f 100644
--- a/sched.c
+++ b/sched.c
@@ -155,6 +155,8 @@ int
pthread_setschedparam(pthread_t thread, int policy,
const struct sched_param *param)
{
+ int prio;
+
/* Validate the thread id. */
if (thread == NULL || thread->threadH == 0)
{
@@ -173,15 +175,17 @@ pthread_setschedparam(pthread_t thread, int policy,
return ENOTSUP;
}
+ prio = param->sched_priority;
+
/* Validate priority level. */
- if (param->sched_priority < sched_get_priority_min(policy) ||
- param->sched_priority > sched_get_priority_max(policy))
+ if (prio < sched_get_priority_min(policy) ||
+ prio > sched_get_priority_max(policy))
{
return EINVAL;
}
/* This is practically guaranteed to return TRUE. */
- (void) SetThreadPriority(thread->threadH, param->sched_priority);
+ (void) SetThreadPriority(thread->threadH, prio);
return 0;
}
@@ -253,7 +257,7 @@ sched_get_priority_max(int policy)
return sched_Max(THREAD_PRIORITY_IDLE, THREAD_PRIORITY_TIME_CRITICAL);
#else
/* This is independent of scheduling policy in Win32. */
- return sched_Max(THREAD_PRIORITY_LOWEST, THREAD_PRIORITY_HIGHEST);
+ return sched_Max(THREAD_PRIORITY_IDLE, THREAD_PRIORITY_TIME_CRITICAL)
#endif
}
@@ -271,7 +275,7 @@ sched_get_priority_min(int policy)
return sched_Min(THREAD_PRIORITY_IDLE, THREAD_PRIORITY_TIME_CRITICAL);
#else
/* This is independent of scheduling policy in Win32. */
- return sched_Min(THREAD_PRIORITY_LOWEST, THREAD_PRIORITY_HIGHEST);
+ return sched_Min(THREAD_PRIORITY_IDLE, THREAD_PRIORITY_TIME_CRITICAL);
#endif
}