Date: Fri, 3 May 2002 09:38:17 -0700 (PDT) From: Julian Elischer <julian@elischer.org> To: Jonathan Mini <mini@freebsd.org> Cc: Perforce Change Reviews <perforce@freebsd.org> Subject: Re: PERFORCE change 10740 for review Message-ID: <Pine.BSF.4.21.0205030933430.82741-100000@InterJet.elischer.org> In-Reply-To: <20020503085009.C81190@stylus.haikugeek.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 3 May 2002, Jonathan Mini wrote: > Julian Elischer [julian@elischer.org] wrote : > > > On Fri, 3 May 2002, Jonathan Mini wrote: > > Oho! Well, then. =) > I see what was going on now. > I misread the code and though that p_xxthread was a pointer. =) > > I can change the code back, no problem, but I still feel that thread_alloc() > is a more appropriate name (caching allocators are really quite common). > Also, after some discussion between me and jhb on #bsdcode, it became > clear that we'd want a struct thread ctor/dtor pair that'd help with > things like fork and exit. His suggestion was a thread_alloc()/thread_exit() > pair. I haven't really looked into it in detail, so I'm not sure yet. the constructor is thread_alloc and the destructor is thread_exit/thread_free (it takes 2 steps to exit a thread) also check out thread_reap(). I have no problem with calling it thread_alloc except that your reason was spurious. (the clash with "itself"). > > > > - uma_zalloc(,M_WAITOK) will never return NULL, so don't bother > > > testing for it. > > > > You may be right, but I wasn't convinced that M_WAITOK was always > > correct. I was trying to concieve af a case where you may not ba able to > > wait when trying ot allocate a new thread.. > > for example if you are trying to allocate it when you are already in > > msleep().. it may be bad to sleep when in msleep already... > > I think I may have other ways to stop this but think about it and > > check the anti-recursion code in msleep(). > > It may be that M_NOWAIT is the right answer.. > > Hmm. Why would you allocate a thread from within msleep()? > Umm MOST threads are allocated from either msleep or fork. remember in a threaded process you allocate and activate a new thread when the old one blocks (i.e. is in msleep()). So to answer your question.. this is about the most common case.. :-) > -- > Jonathan Mini <mini@freebsd.org> > http://www.haikugeek.com > > "He who is not aware of his ignorance will be only misled by his knowledge." > -- Richard Whatley > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0205030933430.82741-100000>