Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 05 Oct 2000 08:55:09 -0700
From:      Jake Burkholder <jburkhol@home.com>
To:        Mark Murray <mark@grondar.za>
Cc:        Boris Popov <bp@butya.kz>, freebsd-smp@FreeBSD.ORG
Subject:   Re: Problems with kthread_exit() and SMPng 
Message-ID:  <20001005155509.24CD9BA76@io.yi.org>
In-Reply-To: Message from Mark Murray <mark@grondar.za>  of "Thu, 05 Oct 2000 13:47:34 %2B0200." <200010051147.e95BlZL04193@grimreaper.grondar.za> 

next in thread | previous in thread | raw e-mail | index | archive | help
> > 	Currently I'm trying to make KLD which uses kernel threads
> > unloadable under recent -current.
> 
> I have exactly the same problem with the devrandom driver. I'll
> test your patch with my driver.
> 
> Thanks!
> 

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.

Jake




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?20001005155509.24CD9BA76>