This function tends to get called at driver start time. start() is
guaranteed to be single threaded so there isn't really a threading
issue.
Godfrey
On 04/08/2006, at 12:10 AM, Howard Gayle wrote:
Apple's "I/O Kit Fundamentals" guide http://developer.apple.com/documentation/DeviceDrivers/Conceptual/
IOKitFundamentals/index.html
has an example under
Handling Events > Work Loops > Listing 7-1
of overriding getWorkLoop(). The example tries to make
getWorkLoop() thread-safe. I have some concerns about the
example code, but does getWorkLoop() really need to be
thread-safe? I couldn't find any real code that worries about
this. The code in AppleRAIDSet.cpp in AppleRAID is pretty
typical:
IOWorkLoop * AppleRAIDSet::getWorkLoop(void)
{
// Create a WorkLoop if it has not already been done.
if (arSetWorkLoop == 0) {
arSetWorkLoop = IOWorkLoop::workLoop();
}
return arSetWorkLoop;
}
Is there a race condition where two different threads could call
getWorkLoop(), resulting in the unwanted creation of two
different IOWorkLoop objects?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden