• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Should getWorkLoop be thread-safe?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Should getWorkLoop be thread-safe?


  • Subject: Re: Should getWorkLoop be thread-safe?
  • From: Godfrey van der Linden <email@hidden>
  • Date: Fri, 4 Aug 2006 10:35:10 +1000

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:
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: This email sent to email@hidden
References: 
 >Should getWorkLoop be thread-safe? (From: Howard Gayle <email@hidden>)

  • Prev by Date: Re: Re: Total RAM slot count obtained programatically
  • Next by Date: Re: Problems with open() and close()
  • Previous by thread: Should getWorkLoop be thread-safe?
  • Next by thread: Problems with open() and close()
  • Index(es):
    • Date
    • Thread