Paul Durrant wrote:
> On 04/09/07, Joachim Worringen <[EMAIL PROTECTED]> wrote:
>
>> I'm porting a driver from Linux to (Open)Solaris. The driver uses its own
>> threads, which under Linux are created with a simple kernel_thread() call. I
>> don't see such a call under Solaris. A solution could be to create a task
>> queue with a single thread, and commit a single task to this queue, which
>> then runs until the driver eventually is stopped. Is this feasible, or are
>> there other, "cleaner" solutions?
>>
>
> I'm sure there are many solutions involving taskqs/timeout/cyclics
> that could be arrived it. However, you *can* create a thread;
> thread_create() will do it for you (I think it's in kthread.c). I
> don't believe it's in the DDI, but IMO it should be as it can be
> highly useful.
>
> Paul
>
>
The main problem with using a thread, is that the details for CPR-safety
(suspend/resume) are not well documented, and rely on structures and
macros. I think if we could address the CPR safety issues, then maybe
we could bring thread creation in to the DDI.
There is a class of problems for which taskq's are suboptimal. For one
thing, dispatching to a taskq can fail, whereas waking a thread via a
condition variable is guaranteed to succeed and is always safe even from
interrupt context.
-- Garrett
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code