Re: kernel thread support - LWP's

Andi Kleen (ak@muc.de)
Sun, 18 Jul 1999 19:00:26 +0200


On Sun, Jul 18, 1999 at 09:46:51AM -0700, Ulrich Drepper wrote:
> Andi Kleen <ak-uu@muc.de> writes:
>
> > I am missing something here, but why can't you set the scheduler in the
> > thread, using the trampoline ?
>
> Because the result whether setting the values is successful or not
> must be available in the manager. In case the values cannot be set
> the newly created thread must not run at all.

void trampoline(void (*func)(void *), struct thr_data *thr)
{
if (thr->scheduler) {
struct sched_param p = { sched_priority: thr->sched_pri };
thr->setuperr = sched_setscheduler(getpid(), thr->scheduler, &p);
if (thr->setuperr < 0) {
_exit(-1)
}
}

func(thr->data);

..
}

Manager checks thr->setuperr after waitpid().
The thread itself never runs when it fails.

-Andi

P.S.: What do you think about the cmpxchg emulation in kernel idea to speed up
the mutexes?

-- 
This is like TV. I don't like TV.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/