> > > On Fri, 25 Jan 2008, ramana polamarasetti wrote: > > > Hi, > > Can anyone tell me what are all the differences > between the threads created with thread_create() and > those created with lwp_create()? > > And is there any way to get an lwp, but using > thread_create()? > > > > Thanks for any help, > > Ramana > > Where do you want to create threads ? In you > application ? In a kernel > driver of yours ? In my kernel module. > > If the former, i.e. you want to use threads in your > application, then > you're way along the wrong path, check thr_create() > resp. pthread_create() > instead. > > If the latter, i.e. you want to create a thread from > within your kernel > driver, then please consider first whether other > asynchronous mechanisms > (taskq or timeout) would do instead. The use of > threads breaks power > management interfaces, and creates > difficult-to-deal-with races on driver > unloading. In any case, if you have to it's > thread_create(). > > Calling lwp_create from a kernel driver will get you > into trouble. Why > would you want to create an LWP from within a kernel > driver ? > My present code uses thread_create(). I am seeing kernel panics due to an ASSERT fail in the sfmmu_tsbmiss_exception(). > > If you're looking for something entirely different, > the way how to find > out which LWP is executing your kernel driver code, > use: > > klwp_t *curlwp = ttolwp(threadp()); > Can you clarify what you want to achieve ? > If I do this in my thread, I am getting curlwp as NULL. because there is no LWP created when I do a thread_create(). And this sfmmu_tsbmiss_exception() is doing the same thing.
11824 /* 11825 * Must set lwp state to LWP_SYS before 11826 * trying to acquire any adaptive lock 11827 */ 11828 lwp = ttolwp(curthread); 11829 ASSERT(lwp); // this is causing kernel panic So, to avoid this I was just trying to see if it is possible to use lwp_create(). > > thanks, > FrankH. > _______________________________________________ > opensolaris-discuss mailing list > opensolaris-discuss@opensolaris.org Thanks for the reply. This message posted from opensolaris.org _______________________________________________ opensolaris-discuss mailing list opensolaris-discuss@opensolaris.org