Date: Mon, 15 Jan 2001 14:17:19 -0800 (PST) From: John Baldwin <jhb@FreeBSD.org> To: Alfred Perlstein <bright@wintelcom.net> Cc: arch@FreeBSD.org Subject: RE: kthread_* api pretty rough Message-ID: <XFMail.010115141719.jhb@FreeBSD.org> In-Reply-To: <20010114064356.Q7240@fw.wintelcom.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On 14-Jan-01 Alfred Perlstein wrote: > I was pretty excited to see that we're using kthread_ stuff, however > actually using it is a bit more complex than I'd hoped. > > There's a couple of questions that I didn't see answered in the > manpage: > > 1) how to actually start the thread? kern/kern_idle.c and > kern/kern_intr.c both have somewhat different things that they > fiddle with in the proc struct returned by kthread_create. They are special. Just use kthread_create(). > 2) is simply calling kthread_exit(); enough to clean up the thread? Yes. Note that right now you need to have Giant before you call it. > 3) what are the state of the locks when the thread runs initially? > what about what state they need to be in before calling kthread_exit()? Nothing is held when it starts. Giant and only Giant should be held when calling exit. > 4) why we need to fiddle with the proc flags after starting a kthread > instead of having kthread_create do it for us. You don't. > 5) do i really want to be using kproc_start instead of kthread_create? > I just want to run a couple of threads to do some microbenchmarks > on some code I'm testing. kproc_start() is a function used in SYSINIT()'s to start up things like bufdaemon, etc. (Did you read the manpage? :) > 6) shouldn't the stuff to OR with the process flags be made into > an arg to kthread_create? Most users don't set anything in the process flags that I know of.. -- John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.010115141719.jhb>