Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: thread_call_allocate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: thread_call_allocate



Hi Mike,

Thank you. My driver very similar with EHCI, but I don't have read hardware. My USB data will transfer with network(kernel mode socket).

In the EHCI, there is a interrupt to process data when the hardware get the data from USB bus. But my USB data is come from network, I need wait the "recv" function return network packet to me.

So far, my solution is using a thread to recv network data and complete the USBIOCommand.
Does there are any sample code or solution can help me complete IO request without using Hardware interrupt??



Michael Smith wrote:

On Jun 19, 2008, at 11:33 PM, James Chan wrote:

I trace some source code download form ADC, but some function call I can not understand.

There are 2 functions named "thread_call_allocate" and "thread_call_enter", but I can not find any document on XCode reference library.

These functions are of the "if you don't understand what they're doing, you probably shouldn't be using them" variety.


On the document "Kernel Porgramming Guide" - Kernel Thread APIs, it shows there is a IOCreadeThread API to create thread in kernel.

Does any know what kind of difference between using IOCreadeThread and thread_call_allocate + thread_call_enter??

Yes.

Where I can get the document??

You already have it; it's the source code. The thread_call_* API manipulates thread call structures, which are typically used to schedule deferred tasks in non-I/O Kit contexts. For I/O Kit threads you will typically want to use a workloop and the relevant event sources.


If I using thread_call_allocate and thread_call_enter, the task ID of this thread is the some with which task??

thread_call_allocate/thread_call_enter do not create threads.

IOCreateThread will create a thread associated with the kernel task.

Typically, when someone asks "how do I create a thread in the [Darwin] kernel", they are trying to port a Windows driver, or write a driver or kernel extension in the Windows style. The best advice that can be offered when you are doing this is - stop.

Darwin is not Windows, and I/O Kit is not WDM. You will be much happier learning how I/O Kit drivers and kernel extensions are meant to be written, and writing a driver or extension in that style. Trying to do things the Windows Way will only make you sad.


= Mike




--
James Chan
Software Engineer
Elitesilicon

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-drivers mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >thread_call_allocate (From: James Chan <email@hidden>)
 >Re: thread_call_allocate (From: Michael Smith <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.