Date: Thu, 05 Oct 2000 20:26:41 +0200 From: Mark Murray <mark@grondar.za> To: Jake Burkholder <jburkhol@home.com> Cc: Mark Murray <mark@grondar.za>, Boris Popov <bp@butya.kz>, freebsd-smp@FreeBSD.ORG Subject: Re: Problems with kthread_exit() and SMPng Message-ID: <200010051826.e95IQfJ12260@grimreaper.grondar.za> In-Reply-To: <20001005155509.24CD9BA76@io.yi.org> ; from Jake Burkholder <jburkhol@home.com> "Thu, 05 Oct 2000 08:55:09 MST." References: <20001005155509.24CD9BA76@io.yi.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> I'll bet that you just need to hold Giant before calling
> kthread_exit(), since exit1() isn't MP-safe yet. Running
> kernel threads outside of the lock is pretty iffy right now.
>
> void
> my_thread(void*arg)
> {
> while(wearewanted) {
> do_something();
> tsleep();
> }
> exited = 1;
> mtx_enter(&Giant, MTX_DEF);
> kthread_exit(0);
> }
>
> This should work, but depending on what you're doing it might
> be better to grab Giant as the first thing the thread does.
Hmm. I'll try that. Will the (kthread_)exit release Giant?
My thread does a lot of work; if it holds Giant, then it can't be
preempted. That would be a problem.
There is another problem; printf's inside a kthread corrupt like
crazy. They look very unthreadsafe.
M
--
Mark Murray
Join the anti-SPAM movement: http://www.cauce.org
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-smp" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200010051826.e95IQfJ12260>
