diff options
author | rpj <rpj> | 1999-01-03 18:47:50 +0000 |
---|---|---|
committer | rpj <rpj> | 1999-01-03 18:47:50 +0000 |
commit | 36f0ed4155fdab7b12c5c5ddf4252170fac0a77e (patch) | |
tree | 2d8ed62df0b72d42a74b383d389ee7c28a0324da /sched.c | |
parent | 4650bcf1f1efd88a0c8f502c28945bfabd7ef6db (diff) |
Merge John Bossom's code into the main trunk. See ChangeLog for details.snapshot-1999-01-04-1305
This will be tagged as snapshot-1999-01-04-1305
Diffstat (limited to 'sched.c')
-rw-r--r-- | sched.c | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -15,7 +15,9 @@ static int is_attr(const pthread_attr_t *attr) { - return (attr == NULL || attr->valid != _PTHREAD_ATTR_VALID) ? 1 : 0; + return (attr == NULL || + *attr == NULL || + (*attr)->valid != _PTHREAD_ATTR_VALID) ? 1 : 0; } int @@ -27,11 +29,12 @@ pthread_attr_setschedparam(pthread_attr_t *attr, return EINVAL; } - attr->priority = param->sched_priority; + (*attr)->priority = param->sched_priority; return 0; } -int pthread_attr_getschedparam(const pthread_attr_t *attr, +int +pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param) { if (is_attr(attr) != 0 || param == NULL) @@ -39,7 +42,7 @@ int pthread_attr_getschedparam(const pthread_attr_t *attr, return EINVAL; } - param->sched_priority = attr->priority; + param->sched_priority = (*attr)->priority; return 0; } @@ -47,7 +50,7 @@ int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param) { /* Validate the thread id. */ - if (_PTHREAD_VALID(thread) < 0) + if (thread == NULL || thread->threadH == 0) { return EINVAL; } @@ -72,7 +75,8 @@ int pthread_setschedparam(pthread_t thread, int policy, } /* This is practically guaranteed to return TRUE. */ - (void) SetThreadPriority(thread->win32handle, param->sched_priority); + (void) SetThreadPriority(thread->threadH, param->sched_priority); + return 0; } @@ -82,7 +86,7 @@ int pthread_getschedparam(pthread_t thread, int *policy, int prio; /* Validate the thread id. */ - if (_PTHREAD_VALID(thread) != 0) + if (thread == NULL || thread->threadH == 0) { return EINVAL; } @@ -97,7 +101,7 @@ int pthread_getschedparam(pthread_t thread, int *policy, *policy = SCHED_OTHER; /* Fill out the sched_param structure. */ - prio = GetThreadPriority(thread->win32handle); + prio = GetThreadPriority(thread->threadH); if (prio == THREAD_PRIORITY_ERROR_RETURN) { return EINVAL; |