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 ?

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 ?


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 ?


thanks,
FrankH.
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to