diff options
Diffstat (limited to 'linuxthreads')
-rw-r--r-- | linuxthreads/ChangeLog | 9 | ||||
-rw-r--r-- | linuxthreads/manager.c | 12 |
2 files changed, 20 insertions, 1 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index 9c45f6e746..9e30a35ee7 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,12 @@ +1999-05-16 Xavier Leroy <Xavier.Leroy@inria.fr> + + * manager.c: If pthread_create() is given a NULL attribute + and the thread manager runs with a realtime policy, set the + scheduling policy of the newly created thread back to SCHED_OTHER. + * manager.c: If the PTHREAD_INHERIT_SCHED attribute is given, + initialize the schedpolicy field of new_thread->p_start_args + to that of the calling thread. + 1999-04-29 Ulrich Drepper <drepper@cygnus.com> * sysdeps/sparc/sparc64/pt-machine.h (__compare_and_swap): cas diff --git a/linuxthreads/manager.c b/linuxthreads/manager.c index 6bafc868c1..eee4b5c1e1 100644 --- a/linuxthreads/manager.c +++ b/linuxthreads/manager.c @@ -189,9 +189,19 @@ static int pthread_start_thread(void *arg) sigprocmask(SIG_SETMASK, &self->p_start_args.mask, NULL); /* Set the scheduling policy and priority for the new thread, if needed */ if (THREAD_GETMEM(self, p_start_args.schedpolicy) >= 0) + /* Explicit scheduling attributes were provided: apply them */ __sched_setscheduler(THREAD_GETMEM(self, p_pid), THREAD_GETMEM(self, p_start_args.schedpolicy), &self->p_start_args.schedparam); +else if (__pthread_manager_thread.p_priority > 0) + /* Default scheduling required, but thread manager runs in realtime + scheduling: switch new thread to SCHED_OTHER policy */ + { + struct sched_param default_params; + default_params.sched_priority = 0; + __sched_setscheduler(THREAD_GETMEM(self, p_pid), + SCHED_OTHER, &default_params); + } /* Make gdb aware of new thread */ if (__pthread_threads_debug && __pthread_sig_debug > 0) { request.req_thread = self; @@ -347,7 +357,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, sizeof (struct sched_param)); break; case PTHREAD_INHERIT_SCHED: - /* schedpolicy doesn't need to be set, only get priority */ + new_thread->p_start_args.schedpolicy = __sched_getscheduler(father_pid); __sched_getparam(father_pid, &new_thread->p_start_args.schedparam); break; } |